Disable admin routes

This commit is contained in:
floppydiskette 2023-12-31 02:04:42 +00:00
parent 27140bd257
commit 08c8d3e06b
Signed by: fwoppydwisk
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE

View file

@ -56,46 +56,46 @@
/* ------------------------------ Admin Routes ------------------------------ */
Route::get('/admin', function () {
if (!auth()->check()) {
return View::make('errors.no-auth');
}
return View::make('pages.admin.index');
});
Route::get('/admin/guestbook', function () {
if (!auth()->check()) {
return View::make('errors.no-auth');
}
return View::make('pages.admin.guestbook');
});
Route::get('/admin/guestbook/delete', function () {
if (!auth()->check()) {
return View::make('errors.no-auth');
}
$id = request()->input('id');
$entry = DB::table('guestbook__entries')->find($id);
if ($entry) {
// Render a confirmation view
return View::make('pages.admin.guestbook-del-confirm', compact('entry'));
} else {
return View::make('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::make('errors.no-auth');
}
$id = request()->input('id');
DB::table('guestbook__entries')->where('id', $id)->delete();
return back()->with('success', 'Entry deleted successfully!');
});
//Route::get('/admin', function () {
// if (!auth()->check()) {
// return View::make('errors.no-auth');
// }
// return View::make('pages.admin.index');
//});
//
//Route::get('/admin/guestbook', function () {
// if (!auth()->check()) {
// return View::make('errors.no-auth');
// }
// return View::make('pages.admin.guestbook');
//});
//
//Route::get('/admin/guestbook/delete', function () {
// if (!auth()->check()) {
// return View::make('errors.no-auth');
// }
//
// $id = request()->input('id');
// $entry = DB::table('guestbook__entries')->find($id);
//
// if ($entry) {
// // Render a confirmation view
// return View::make('pages.admin.guestbook-del-confirm', compact('entry'));
// } else {
// return View::make('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::make('errors.no-auth');
// }
//
// $id = request()->input('id');
// DB::table('guestbook__entries')->where('id', $id)->delete();
//
// return back()->with('success', 'Entry deleted successfully!');
//});