Update AdminController

This commit is contained in:
Daniel Supernault 2019-06-18 19:50:08 -06:00
parent a72d0964ac
commit a71a2c96b7
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -258,4 +258,25 @@ class AdminController extends Controller
$messages = Contact::orderByDesc('id')->paginate(10); $messages = Contact::orderByDesc('id')->paginate(10);
return view('admin.messages.home', compact('messages')); return view('admin.messages.home', compact('messages'));
} }
public function messagesShow(Request $request, $id)
{
$message = Contact::findOrFail($id);
return view('admin.messages.show', compact('message'));
}
public function messagesMarkRead(Request $request)
{
$this->validate($request, [
'id' => 'required|integer|min:1'
]);
$id = $request->input('id');
$message = Contact::findOrFail($id);
if($message->read_at) {
return;
}
$message->read_at = now();
$message->save();
return;
}
} }