Loading app/Http/Controllers/DivesList.php +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ class DivesList extends Controller { function index(): View { $dives = DivingSession::select('car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') $dives = DivingSession::select('DS_CODE', 'car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') ->join('car_diving_location', 'car_diving_session.DL_ID', '=', 'car_diving_location.DL_ID') ->get(); return view('dives', ['dives' => $dives]); Loading app/Http/Controllers/DivingSignUpController.php +3 −2 Original line number Diff line number Diff line Loading @@ -11,7 +11,8 @@ public function show(){ $userid = session()->get('userid'); if(!preg_match('/[0-9]+/', $userid)) return DivingSignUpController::error(); return view('diving-sign-up'); $divesList = new DivesList(); return $divesList->index(); } public function index($ds_code){ Loading @@ -24,6 +25,6 @@ public function index($ds_code){ } public static function error(){ return view('diving-sign-up')->withErrors(['userid' => 'Error with userid']); return view('dives')->withErrors(['userid' => 'Error with userid']); } } resources/views/components/layout.blade.php +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ </head> <body> <x-header/> <main class="mx-auto max-w-6xl p-4"> <main class="mx-auto max-w-[1028px] p-4"> {{ $slot }} </main> <x-footer/> Loading resources/views/dives.blade.php +13 −1 Original line number Diff line number Diff line Loading @@ -27,8 +27,20 @@ <td class="px-8 py-4">{{ $dive->DL_DEPTH }}</td> <td class="px-8 py-4">{{ $dive->DL_NAME }}</td> <td class="px-8 py-4"> <button class="bg-green-400 hover:bg-green-500 focus:bg-green-500 text-black rounded-lg px-10 py-1.5">S'inscrire</button> @if (Session::has('Success')) <div class="alert alert-info">{{ Session::get('Success') }}</div> @endif <a href='/dives/{{$dive->DS_CODE}}' class="bg-green-400 hover:bg-green-500 focus:bg-green-500 text-black rounded-lg px-10 py-1.5">S'inscrire</a> <button class="bg-yellow-400 hover:bg-yellow-500 focus:bg-yellow-500 text-black rounded-lg px-5 py-1.5">Voir les inscrits</button> @if ($errors->any()) <div class="alert alert-danger"> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif </td> </tr> @endforeach Loading routes/web.php +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ { return view('test', ['user' => User::find(1)]); }); Route::get('/signup/{ds_code}', [DivingSignUpController::class, 'index']); Route::get('/dives/{ds_code}', [DivingSignUpController::class, 'index']); Route::get('/signup', [DivingSignUpController::class, 'show'])->name('signup'); Loading
app/Http/Controllers/DivesList.php +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ class DivesList extends Controller { function index(): View { $dives = DivingSession::select('car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') $dives = DivingSession::select('DS_CODE', 'car_diving_session.DL_ID', 'DS_DATE', 'DL_DEPTH', 'CAR_SCHEDULE', 'DL_NAME') ->join('car_diving_location', 'car_diving_session.DL_ID', '=', 'car_diving_location.DL_ID') ->get(); return view('dives', ['dives' => $dives]); Loading
app/Http/Controllers/DivingSignUpController.php +3 −2 Original line number Diff line number Diff line Loading @@ -11,7 +11,8 @@ public function show(){ $userid = session()->get('userid'); if(!preg_match('/[0-9]+/', $userid)) return DivingSignUpController::error(); return view('diving-sign-up'); $divesList = new DivesList(); return $divesList->index(); } public function index($ds_code){ Loading @@ -24,6 +25,6 @@ public function index($ds_code){ } public static function error(){ return view('diving-sign-up')->withErrors(['userid' => 'Error with userid']); return view('dives')->withErrors(['userid' => 'Error with userid']); } }
resources/views/components/layout.blade.php +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ </head> <body> <x-header/> <main class="mx-auto max-w-6xl p-4"> <main class="mx-auto max-w-[1028px] p-4"> {{ $slot }} </main> <x-footer/> Loading
resources/views/dives.blade.php +13 −1 Original line number Diff line number Diff line Loading @@ -27,8 +27,20 @@ <td class="px-8 py-4">{{ $dive->DL_DEPTH }}</td> <td class="px-8 py-4">{{ $dive->DL_NAME }}</td> <td class="px-8 py-4"> <button class="bg-green-400 hover:bg-green-500 focus:bg-green-500 text-black rounded-lg px-10 py-1.5">S'inscrire</button> @if (Session::has('Success')) <div class="alert alert-info">{{ Session::get('Success') }}</div> @endif <a href='/dives/{{$dive->DS_CODE}}' class="bg-green-400 hover:bg-green-500 focus:bg-green-500 text-black rounded-lg px-10 py-1.5">S'inscrire</a> <button class="bg-yellow-400 hover:bg-yellow-500 focus:bg-yellow-500 text-black rounded-lg px-5 py-1.5">Voir les inscrits</button> @if ($errors->any()) <div class="alert alert-danger"> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif </td> </tr> @endforeach Loading
routes/web.php +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ { return view('test', ['user' => User::find(1)]); }); Route::get('/signup/{ds_code}', [DivingSignUpController::class, 'index']); Route::get('/dives/{ds_code}', [DivingSignUpController::class, 'index']); Route::get('/signup', [DivingSignUpController::class, 'show'])->name('signup');