dashboard-admin/app/Http/Controllers/User/UserContactController.php

78 lines
1.4 KiB
PHP

<?php
namespace App\Http\Controllers\Admin;
use App\Models\Contact;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class ContactController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(Contact $contact)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Contact $contact)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Contact $contact)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Contact $contact, $id)
{
try{
Contact::destroy($id);
return response()->json([
'message' => 'Berhasil hapus data',
'status' => true
]);
}catch(\Exception $e){
return response()->json([
'message' => 'Gagal hapus data, karena '.$e,
'status' => false
]);
}
}
}