wah.moe/routes/web.php

97 lines
2.4 KiB
PHP
Raw Normal View History

2023-06-13 20:59:16 +00:00
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
2023-07-28 22:44:17 +00:00
return view('pages.home');
2023-06-13 20:59:16 +00:00
});
2023-06-13 22:50:07 +00:00
Route::get('/bookmarks', function () {
2023-07-28 22:44:17 +00:00
return view('pages.bookmarks');
2023-06-13 22:50:07 +00:00
});
2023-06-14 21:07:28 +00:00
Route::get('/projects', function () {
2023-07-28 22:44:17 +00:00
return view('pages.projects');
2023-06-14 21:07:28 +00:00
});
2023-06-14 21:08:36 +00:00
Route::get('/calculators', function () {
2023-07-28 22:44:17 +00:00
return view('pages.calculators');
2023-06-14 21:08:36 +00:00
});
2023-06-14 21:10:24 +00:00
Route::get('/computers', function () {
2023-07-28 22:44:17 +00:00
return view('pages.computers');
2023-06-14 21:10:24 +00:00
});
Route::get('/guestbook', 'App\Http\Controllers\GuestbookController@guestbook')
->name('guestbook');
Route::post('/guestbook', 'App\Http\Controllers\GuestbookController@guestbookpost')
->name('guestbookPost')
->middleware('rate_limit');
2023-07-28 22:44:17 +00:00
Route::get('/weather', function () {
return view('pages.weather');
});
Route::get('/music', function ()
{
return view('pages.music');
});
2023-07-29 17:16:08 +00:00
2023-07-28 22:44:17 +00:00
/* ------------------------------ Admin Routes ------------------------------ */
2023-07-16 20:02:51 +00:00
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');
2023-07-19 00:58:32 +00:00
$entry = DB::table('guestbook__entries')->find($id);
2023-07-16 20:02:51 +00:00
if ($entry) {
// Render a confirmation view
2023-07-28 22:44:17 +00:00
return view('pages.admin.guestbook-del-confirm', compact('entry'));
2023-07-16 20:02:51 +00:00
} 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');
2023-07-19 00:58:32 +00:00
DB::table('guestbook__entries')->where('id', $id)->delete();
2023-07-16 20:02:51 +00:00
return back()->with('success', 'Entry deleted successfully!');
});