Loading app/Http/Controllers/DivingNumberController.php +19 −3 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use Illuminate\Support\Facades\Auth; use App\Models\DivingNumberModel; use DateTime; use Illuminate\Http\Request; use Illuminate\View\View; Loading @@ -12,18 +13,18 @@ public function index(): View { $user = Auth::user(); if ($user) { $userId = $user->US_ID; // Utilisez la propriété d'ID de votre modèle User $userId = $user->US_ID; }else{ $userId = 1; } // Assurez-vous que la propriété 'US_ID' est disponible dans la requête ou ajustez selon votre logique $dives = 99; $usersCount = DivingNumberModel::join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_group', function ($dg) { $dg->on('car_registration.ds_code', '=', 'car_diving_group.ds_code') ->on('car_registration.dg_number', '=', 'car_diving_group.dg_number'); }) ->where('car_user.US_ID', 1) ->where('car_user.US_ID', $userId) ->count(); $usersCount = 99 - $usersCount; Loading @@ -44,4 +45,19 @@ public function allIndex(): View return view('alldiversactivities', ['datas' => $usersDatas]); } public function filteredSearch(DateTime $after, DateTime $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(); return view('alldiversactivities', ['datas' => $usersDatas]); } } resources/views/alldiversactivities.blade.php +2 −2 Original line number Diff line number Diff line <x-layout> <x-page-title>Plongées réalisées</x-page-title> <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-400 w-full"> <div class="shadow-md max-w-full rounded-lg overflow-hidden border-2"> <table class="text-sm text-left text-gray-500 w-full"> <thead class="text-xs text-gray-700 uppercase bg-gray-50"> <tr> <th scope="col" class="px-6 py-3">Nom</th> Loading Loading
app/Http/Controllers/DivingNumberController.php +19 −3 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use Illuminate\Support\Facades\Auth; use App\Models\DivingNumberModel; use DateTime; use Illuminate\Http\Request; use Illuminate\View\View; Loading @@ -12,18 +13,18 @@ public function index(): View { $user = Auth::user(); if ($user) { $userId = $user->US_ID; // Utilisez la propriété d'ID de votre modèle User $userId = $user->US_ID; }else{ $userId = 1; } // Assurez-vous que la propriété 'US_ID' est disponible dans la requête ou ajustez selon votre logique $dives = 99; $usersCount = DivingNumberModel::join('car_registration', 'car_user.us_id', '=', 'car_registration.us_id') ->join('car_diving_group', function ($dg) { $dg->on('car_registration.ds_code', '=', 'car_diving_group.ds_code') ->on('car_registration.dg_number', '=', 'car_diving_group.dg_number'); }) ->where('car_user.US_ID', 1) ->where('car_user.US_ID', $userId) ->count(); $usersCount = 99 - $usersCount; Loading @@ -44,4 +45,19 @@ public function allIndex(): View return view('alldiversactivities', ['datas' => $usersDatas]); } public function filteredSearch(DateTime $after, DateTime $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(); return view('alldiversactivities', ['datas' => $usersDatas]); } }
resources/views/alldiversactivities.blade.php +2 −2 Original line number Diff line number Diff line <x-layout> <x-page-title>Plongées réalisées</x-page-title> <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-400 w-full"> <div class="shadow-md max-w-full rounded-lg overflow-hidden border-2"> <table class="text-sm text-left text-gray-500 w-full"> <thead class="text-xs text-gray-700 uppercase bg-gray-50"> <tr> <th scope="col" class="px-6 py-3">Nom</th> Loading