diskfloppy.me/routes/web.php

102 lines
2.6 KiB
PHP
Raw Normal View History

2023-06-13 20:59:16 +00:00
<?php
2023-12-05 00:11:58 +00:00
use Illuminate\Support\Facades\DB;
2023-06-13 20:59:16 +00:00
use Illuminate\Support\Facades\Route;
2023-12-05 00:19:48 +00:00
use Illuminate\Support\Facades\View;
2023-06-13 20:59:16 +00:00
/*
|--------------------------------------------------------------------------
| 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-12-05 00:19:48 +00:00
return View::make('pages.home');
2023-06-13 20:59:16 +00:00
});
2023-06-13 22:50:07 +00:00
Route::get('/bookmarks', function () {
2023-12-05 00:19:48 +00:00
return View::make('pages.bookmarks');
2023-06-13 22:50:07 +00:00
});
2023-06-14 21:07:28 +00:00
Route::get('/projects', function () {
2023-12-05 00:19:48 +00:00
return View::make('pages.projects');
2023-06-14 21:07:28 +00:00
});
2023-06-14 21:08:36 +00:00
Route::get('/calculators', function () {
2023-12-05 00:19:48 +00:00
return View::make('pages.calculators');
2023-06-14 21:08:36 +00:00
});
2023-06-14 21:10:24 +00:00
Route::get('/computers', function () {
2023-12-05 00:19:48 +00:00
return View::make('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 () {
2023-12-05 00:19:48 +00:00
return View::make('pages.weather');
2023-07-28 22:44:17 +00:00
});
2023-08-22 11:03:05 +00:00
Route::get('/music', function () {
2023-12-05 00:19:48 +00:00
return View::make('pages.music');
});
2023-07-29 17:16:08 +00:00
2023-08-22 11:03:05 +00:00
Route::get('/bot', function () {
2023-12-05 00:19:48 +00:00
return View::make('pages.bot');
2023-08-22 11:03:05 +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()) {
2023-12-05 00:19:48 +00:00
return View::make('errors.no-auth');
2023-07-16 20:02:51 +00:00
}
2023-12-05 00:19:48 +00:00
return View::make('pages.admin.index');
2023-07-16 20:02:51 +00:00
});
Route::get('/admin/guestbook', function () {
if (!auth()->check()) {
2023-12-05 00:19:48 +00:00
return View::make('errors.no-auth');
2023-07-16 20:02:51 +00:00
}
2023-12-05 00:19:48 +00:00
return View::make('pages.admin.guestbook');
2023-07-16 20:02:51 +00:00
});
Route::get('/admin/guestbook/delete', function () {
if (!auth()->check()) {
2023-12-05 00:19:48 +00:00
return View::make('errors.no-auth');
2023-07-16 20:02:51 +00:00
}
$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-12-05 00:19:48 +00:00
return View::make('pages.admin.guestbook-del-confirm', compact('entry'));
2023-07-16 20:02:51 +00:00
} else {
2023-12-05 00:19:48 +00:00
return View::make('errors.generic-error')
2023-07-16 20:02:51 +00:00
->with('error', "Entry not found")
->with('description', "The specified entry does not exist!");
}
});
Route::post('/admin/guestbook/delete', function () {
if (!auth()->check()) {
2023-12-05 00:19:48 +00:00
return View::make('errors.no-auth');
2023-07-16 20:02:51 +00:00
}
$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!');
});