name('guestbook'); Route::post('/guestbook', 'App\Http\Controllers\GuestbookController@guestbookpost') ->name('guestbookPost') ->middleware('rate_limit'); Route::get('/weather', function () { return view('pages.weather'); }); Route::get('/music', function () { return view('pages.music'); }); /* ------------------------------ Admin Routes ------------------------------ */ Route::get('/admin', function () { if (!auth()->check()) { return view('errors.no-auth'); } return view('pages.admin.index'); }); Route::get('/admin/guestbook', function () { if (!auth()->check()) { return view('errors.no-auth'); } return view('pages.admin.guestbook'); }); Route::get('/admin/guestbook/delete', function () { if (!auth()->check()) { return view('errors.no-auth'); } $id = request()->input('id'); $entry = DB::table('guestbook__entries')->find($id); if ($entry) { // Render a confirmation view return view('pages.admin.guestbook-del-confirm', compact('entry')); } else { return view('errors.generic-error') ->with('error', "Entry not found") ->with('description', "The specified entry does not exist!"); } }); Route::post('/admin/guestbook/delete', function () { if (!auth()->check()) { return view('errors.no-auth'); } $id = request()->input('id'); DB::table('guestbook__entries')->where('id', $id)->delete(); return back()->with('success', 'Entry deleted successfully!'); });