Loading app/Http/Controllers/DivingNumberController.php +23 −7 Original line number Diff line number Diff line Loading @@ -31,8 +31,11 @@ public function index(): View return view('diveractivities', compact('usersCount')); } public function allIndex(): View public function allIndex(Request $request): View { if($request['afterthe'] != '' and $request['beforethe'] != ''){ return DivingNumberController::filteredSearch($request['afterthe'], $request['beforethe']); } $usersDatas = DivingNumberModel::selectRaw('COUNT(*) as aggregate, car_user.US_FIRST_NAME, car_user.US_NAME') ->join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_group', function ($join) { Loading @@ -46,17 +49,30 @@ public function allIndex(): View } public function filteredSearch(DateTime $after, DateTime $before): View public function filteredSearch(string $after, string $before): View { $usersDatas = DivingNumberModel::selectRaw('COUNT(*) as aggregate, car_user.US_FIRST_NAME, car_user.US_NAME') ->join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_session', 'car_registration.ds_code', '=', 'car_diving_session.ds_code') ->where('car_divin_session.ds_date' > $after) ->where('car_divin_session.ds_date' < $before) ->groupBy('car_user.us_id') ->get(); ->join('car_diving_session', function ($join) { $join->on('car_registration.us_id', '=', 'car_diving_session.us_id'); }) ->where('car_diving_session.DS_DATE', '>', '"'.$after.'"') ->where('car_diving_session.DS_DATE', '>', '"'.$before.'"') ->groupBy('car_user.us_id', 'car_user.US_NAME', 'car_user.US_FIRST_NAME') ->tosql(); /*select COUNT(*) as aggregate, car_user.US_FIRST_NAME, car_user.US_NAME from car_user join car_registration on car_user.us_id = car_registration.us_id join car_diving_session on car_registration.us_id = car_diving_session.us_id where '2022-9-30' < car_diving_session.DS_DATE and '2022-10-2' > car_diving_session.DS_DATE group by car_user.us_id, car_user.us_name, car_user.us_first_name;*/ return view('alldiversactivities', ['datas' => $usersDatas]); } } Loading resources/views/alldiversactivities.blade.php +9 −0 Original line number Diff line number Diff line <x-layout> <x-page-title>Plongées réalisées</x-page-title> <form action="?{afterthe}&{beforethe}"> <input type="date" name="afterthe"> <input type="date" name="beforethe"> <button type="submit">Rechercher</button> </form> <div class="shadow-md max-w-full w-2/3 content-between rounded-lg overflow-hidden border-2 mx-auto"> <table class="text-sm text-left text-gray-500 w-full"> <thead class="text-xs text-gray-700 uppercase bg-gray-50"> <tr> Loading routes/web.php +1 −1 Original line number Diff line number Diff line Loading @@ -30,4 +30,4 @@ Route::get('/alldivings', [DivingNumberController::class, 'allIndex']); Route::get('/alldivings?{afterthe}&{beforethe}', [DivingNumberController::class, 'filteredSearch({afterthe}, {beforethe})']); Loading
app/Http/Controllers/DivingNumberController.php +23 −7 Original line number Diff line number Diff line Loading @@ -31,8 +31,11 @@ public function index(): View return view('diveractivities', compact('usersCount')); } public function allIndex(): View public function allIndex(Request $request): View { if($request['afterthe'] != '' and $request['beforethe'] != ''){ return DivingNumberController::filteredSearch($request['afterthe'], $request['beforethe']); } $usersDatas = DivingNumberModel::selectRaw('COUNT(*) as aggregate, car_user.US_FIRST_NAME, car_user.US_NAME') ->join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_group', function ($join) { Loading @@ -46,17 +49,30 @@ public function allIndex(): View } public function filteredSearch(DateTime $after, DateTime $before): View public function filteredSearch(string $after, string $before): View { $usersDatas = DivingNumberModel::selectRaw('COUNT(*) as aggregate, car_user.US_FIRST_NAME, car_user.US_NAME') ->join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_session', 'car_registration.ds_code', '=', 'car_diving_session.ds_code') ->where('car_divin_session.ds_date' > $after) ->where('car_divin_session.ds_date' < $before) ->groupBy('car_user.us_id') ->get(); ->join('car_diving_session', function ($join) { $join->on('car_registration.us_id', '=', 'car_diving_session.us_id'); }) ->where('car_diving_session.DS_DATE', '>', '"'.$after.'"') ->where('car_diving_session.DS_DATE', '>', '"'.$before.'"') ->groupBy('car_user.us_id', 'car_user.US_NAME', 'car_user.US_FIRST_NAME') ->tosql(); /*select COUNT(*) as aggregate, car_user.US_FIRST_NAME, car_user.US_NAME from car_user join car_registration on car_user.us_id = car_registration.us_id join car_diving_session on car_registration.us_id = car_diving_session.us_id where '2022-9-30' < car_diving_session.DS_DATE and '2022-10-2' > car_diving_session.DS_DATE group by car_user.us_id, car_user.us_name, car_user.us_first_name;*/ return view('alldiversactivities', ['datas' => $usersDatas]); } } Loading
resources/views/alldiversactivities.blade.php +9 −0 Original line number Diff line number Diff line <x-layout> <x-page-title>Plongées réalisées</x-page-title> <form action="?{afterthe}&{beforethe}"> <input type="date" name="afterthe"> <input type="date" name="beforethe"> <button type="submit">Rechercher</button> </form> <div class="shadow-md max-w-full w-2/3 content-between rounded-lg overflow-hidden border-2 mx-auto"> <table class="text-sm text-left text-gray-500 w-full"> <thead class="text-xs text-gray-700 uppercase bg-gray-50"> <tr> Loading
routes/web.php +1 −1 Original line number Diff line number Diff line Loading @@ -30,4 +30,4 @@ Route::get('/alldivings', [DivingNumberController::class, 'allIndex']); Route::get('/alldivings?{afterthe}&{beforethe}', [DivingNumberController::class, 'filteredSearch({afterthe}, {beforethe})']);