Laver edit, show, update,delete controller for contacts

This commit is contained in:
Neerholt 2020-06-29 11:48:36 +02:00
parent cee2818046
commit a0a6f1a9cb
1 changed files with 17 additions and 4 deletions

View File

@ -61,7 +61,8 @@ class ContactController extends Controller
*/ */
public function show($id) public function show($id)
{ {
// return Response::detect("contacts.show", [ "contacts" => $id]);
} }
/** /**
@ -72,7 +73,8 @@ class ContactController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
// $contacts = Contact::find($id);
return Response::detect("contacts.edit", ["contact" => $contacts]);
} }
/** /**
@ -84,7 +86,15 @@ class ContactController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
//
$data = $request->all();
//FORCED UPDATE
$contact = Contact::find($id);
$contact->update($data);
$contact->save();
return Response::detect("contacts.update", [ "contact" => $contact ]);
} }
/** /**
@ -95,6 +105,9 @@ class ContactController extends Controller
*/ */
public function destroy($id) public function destroy($id)
{ {
//
$contact = Contact::find($id);
$contact->delete();
return redirect()->route("contacts.index");
} }
} }