From 2246f18d075055c3e77610982bd87199470207b3 Mon Sep 17 00:00:00 2001 From: Witel Group Date: Sun, 14 Jul 2024 10:58:05 +0000 Subject: [PATCH] refactored some routes --- public/index.php | 6 +++--- routes/web.php | 25 +++++++++++-------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/public/index.php b/public/index.php index 1d69f3a2..f3c2ebcd 100644 --- a/public/index.php +++ b/public/index.php @@ -16,7 +16,7 @@ define('LARAVEL_START', microtime(true)); | */ -if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) { +if (file_exists($maintenance = __DIR__ . '/../storage/framework/maintenance.php')) { require $maintenance; } @@ -31,7 +31,7 @@ if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) | */ -require __DIR__.'/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- @@ -44,7 +44,7 @@ require __DIR__.'/../vendor/autoload.php'; | */ -$app = require_once __DIR__.'/../bootstrap/app.php'; +$app = require_once __DIR__ . '/../bootstrap/app.php'; $kernel = $app->make(Kernel::class); diff --git a/routes/web.php b/routes/web.php index 0fac35aa..b719c379 100644 --- a/routes/web.php +++ b/routes/web.php @@ -51,10 +51,6 @@ Route::middleware('auth')->group(function () { // }); // Route::post('technotransport2022', 'TechnoTransportController@addTechnoTransport'); -// Route::get('csrf', function () { -// Auth::loginUsingId(1156); -// return csrf_token(); -// }); // /// project list begin @@ -814,10 +810,6 @@ Route::post('webapi/cmms/search', 'Api\CMMSController@search'); // Route::get('webapi/randd/voting/{id}/result', 'Api\RandDVoting\VoterController@showResult'); // Route::post('webapi/randd/voting/{id}/end', 'Api\RandDVoting\AdminVoterController@endVoting'); -// Route::post('webapi/request', function (Illuminate\Http\Request $request) { -// return $request->all(); -// }); - // Route::get('create_temp_role', function () { // return Auth::loginUsingId(469); // // User::find(1069)->assignRole('RandD'); @@ -986,10 +978,6 @@ Route::middleware('web', 'auth', 'confirmUser')->group(function () { // Route::get("milaaaaad", 'PostersController@develooooooo0p'); -// // Route::get('dev_csrffff', function(){ -// // auth()->loginUsingId(User::where('username', 'witel')->first()->id); -// // // return csrf_token(); -// // }); // //road observation begin 1401 @@ -1504,13 +1492,22 @@ Route::get('/', function () { // return 'ok'; // }); + + +// CAUTION: DON'T DISABLE CORS POLICY +Route::get('csrf', function () { + return response()->json([ + 'data' => csrf_token() + ]); +}); + if (config('global_variables.IS_DEVELOPMENT_ENV') === true) { + Route::get('login_dev', function (Request $request) { - $request->validate([ 'username' => 'required', ]); Auth::loginUsingId(User::where('username', $request->username)->first()->id); }); -} \ No newline at end of file +}