Loading app/Http/Controllers/DiversBySession.php +10 −5 Original line number Diff line number Diff line Loading @@ -3,15 +3,16 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\DiversListBySession; use App\Models\User; use Illuminate\View\View; class DiversBySession extends Controller { public function getDiversBySession(): View public function getDiversBySession($ds_code): View { $request = DiversListBySession::selectRaw('US_NAME, US_FIRST_NAME, DS_CODE') $request = User::selectRaw('US_NAME, US_FIRST_NAME') ->join('CAR_REGISTRATION','CAR_USER.US_ID','=','CAR_REGISTRATION.US_ID') ->groupBy('DS_CODE') ->get(); return view('diversinsessions', ['datas' => $request]); Loading @@ -19,8 +20,12 @@ public function getDiversBySession(): View public function getAllSessions(): View { $request = DiversListBySession::selectRaw('DS_CODE') $request = User::join('car_registration', 'car_user.US_ID', '=', 'car_registration.US_ID') ->groupBy('car_registration.ds_code', 'car_user.us_name', 'car_user.US_FIRST_NAME') ->select('car_user.us_name', 'car_user.US_FIRST_NAME', 'car_registration.ds_code') ->get(); return view('diversinsessions',['sessions' => $request]); } } app/Models/DiversListBySession.phpdeleted 100644 → 0 +0 −13 Original line number Diff line number Diff line <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class DiversListBySession extends Model { protected $table = 'CAR_REGISTRATION'; protected $primaryKey = ['us_id', 'ds_code']; use HasFactory; } resources/views/diversinsessions.php +51 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes routes/web.php +4 −1 Original line number Diff line number Diff line <?php use App\Http\Controllers\DiversBySession; use App\Http\Controllers\DivesList; use App\Models\DivingSession; use App\Http\Controllers\DivingSignUpController; Loading Loading @@ -72,4 +73,6 @@ return view('create_dive', ['locations' => DivingLocation::all(), 'boats' => Boat::all()]); }); Route::get('/sessions', [Session::class,'index']); No newline at end of file Route::get('/sessions', [DiversBySession::class,'getAllSessions']); Route::get('/session/{ds_code}', [DiversBySession::class,'getDiversBySession']); No newline at end of file Loading
app/Http/Controllers/DiversBySession.php +10 −5 Original line number Diff line number Diff line Loading @@ -3,15 +3,16 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\DiversListBySession; use App\Models\User; use Illuminate\View\View; class DiversBySession extends Controller { public function getDiversBySession(): View public function getDiversBySession($ds_code): View { $request = DiversListBySession::selectRaw('US_NAME, US_FIRST_NAME, DS_CODE') $request = User::selectRaw('US_NAME, US_FIRST_NAME') ->join('CAR_REGISTRATION','CAR_USER.US_ID','=','CAR_REGISTRATION.US_ID') ->groupBy('DS_CODE') ->get(); return view('diversinsessions', ['datas' => $request]); Loading @@ -19,8 +20,12 @@ public function getDiversBySession(): View public function getAllSessions(): View { $request = DiversListBySession::selectRaw('DS_CODE') $request = User::join('car_registration', 'car_user.US_ID', '=', 'car_registration.US_ID') ->groupBy('car_registration.ds_code', 'car_user.us_name', 'car_user.US_FIRST_NAME') ->select('car_user.us_name', 'car_user.US_FIRST_NAME', 'car_registration.ds_code') ->get(); return view('diversinsessions',['sessions' => $request]); } }
app/Models/DiversListBySession.phpdeleted 100644 → 0 +0 −13 Original line number Diff line number Diff line <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class DiversListBySession extends Model { protected $table = 'CAR_REGISTRATION'; protected $primaryKey = ['us_id', 'ds_code']; use HasFactory; }
resources/views/diversinsessions.php +51 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes
routes/web.php +4 −1 Original line number Diff line number Diff line <?php use App\Http\Controllers\DiversBySession; use App\Http\Controllers\DivesList; use App\Models\DivingSession; use App\Http\Controllers\DivingSignUpController; Loading Loading @@ -72,4 +73,6 @@ return view('create_dive', ['locations' => DivingLocation::all(), 'boats' => Boat::all()]); }); Route::get('/sessions', [Session::class,'index']); No newline at end of file Route::get('/sessions', [DiversBySession::class,'getAllSessions']); Route::get('/session/{ds_code}', [DiversBySession::class,'getDiversBySession']); No newline at end of file