Loading app/Http/Controllers/DiveSessionCreation.php 0 → 100644 +30 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\DivingSession; class DiveSessionCreation extends Controller { /** * Add */ public static function add($request) { $dv = new DivingSession(); $dv->DS_CODE = 'DS'.sizeof(DivingSession::all())+1; $dv->US_ID = $request->pilot; $dv->DL_ID = $request->location; $dv->BO_ID = $request->boat; $dv->US_ID_CAR_SECURE = $request->security; $dv->US_ID_CAR_DIRECT = $request->manager; $dv->DS_DATE = $request->day; $dv->DS_MAX_DEPTH = $request->maxDepth; $dv->DS_ACTIVE = 1; $dv->DS_MAX_DIVERS = $request->max; $dv->DS_LEVEL = $request->level; $dv->save(); } } app/Http/Controllers/DivesList.php +2 −2 Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ class DivesList extends Controller { function index(): View { $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') $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 −3 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ class DivingSignUpController extends Controller { public function show(){ $userid = session()->get('userid'); if(!preg_match('/[0-9]+/', $userid)) return DivingSignUpController::error(); Loading @@ -18,11 +17,12 @@ public function show(){ public function index($ds_code){ $userid = session()->get('userid'); session()->put('DS_CODE', $ds_code); $request = DivingSignUpModel::select()->where('US_ID', $userid)->where('DS_CODE', $ds_code)->count(); if(!$request == 0) return redirect()->route('dives')->withErrors(['already_registered' => 'Error already registered']); $request = DivingSignUpModel::insert(['US_ID' => $userid, 'DS_CODE' => $ds_code]); return redirect()->route('dives')->with('Success', 'inscription success'); $request = DivingSignUpModel::insert(['US_ID' => $userid, 'DS_CODE' => $ds_code, 'REG_ACTIVE' => 1]); return redirect()->route('dives')->with('Success', 'Inscription Success'); } public static function error(){ Loading app/Models/DivingLocation.php +1 −0 Original line number Diff line number Diff line Loading @@ -12,4 +12,5 @@ class DivingLocation extends Model protected $table = 'CAR_DIVING_LOCATION'; protected $primaryKey = 'DL_ID'; } app/Models/DivingSession.php +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ */ class DivingSession extends Model { protected $table = 'car_diving_session'; protected $table = 'CAR_DIVING_SESSION'; protected $primaryKey = 'DS_CODE'; protected $keyType = 'string'; public $timestamps = false; Loading Loading
app/Http/Controllers/DiveSessionCreation.php 0 → 100644 +30 −0 Original line number Diff line number Diff line <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Models\DivingSession; class DiveSessionCreation extends Controller { /** * Add */ public static function add($request) { $dv = new DivingSession(); $dv->DS_CODE = 'DS'.sizeof(DivingSession::all())+1; $dv->US_ID = $request->pilot; $dv->DL_ID = $request->location; $dv->BO_ID = $request->boat; $dv->US_ID_CAR_SECURE = $request->security; $dv->US_ID_CAR_DIRECT = $request->manager; $dv->DS_DATE = $request->day; $dv->DS_MAX_DEPTH = $request->maxDepth; $dv->DS_ACTIVE = 1; $dv->DS_MAX_DIVERS = $request->max; $dv->DS_LEVEL = $request->level; $dv->save(); } }
app/Http/Controllers/DivesList.php +2 −2 Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ class DivesList extends Controller { function index(): View { $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') $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 −3 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ class DivingSignUpController extends Controller { public function show(){ $userid = session()->get('userid'); if(!preg_match('/[0-9]+/', $userid)) return DivingSignUpController::error(); Loading @@ -18,11 +17,12 @@ public function show(){ public function index($ds_code){ $userid = session()->get('userid'); session()->put('DS_CODE', $ds_code); $request = DivingSignUpModel::select()->where('US_ID', $userid)->where('DS_CODE', $ds_code)->count(); if(!$request == 0) return redirect()->route('dives')->withErrors(['already_registered' => 'Error already registered']); $request = DivingSignUpModel::insert(['US_ID' => $userid, 'DS_CODE' => $ds_code]); return redirect()->route('dives')->with('Success', 'inscription success'); $request = DivingSignUpModel::insert(['US_ID' => $userid, 'DS_CODE' => $ds_code, 'REG_ACTIVE' => 1]); return redirect()->route('dives')->with('Success', 'Inscription Success'); } public static function error(){ Loading
app/Models/DivingLocation.php +1 −0 Original line number Diff line number Diff line Loading @@ -12,4 +12,5 @@ class DivingLocation extends Model protected $table = 'CAR_DIVING_LOCATION'; protected $primaryKey = 'DL_ID'; }
app/Models/DivingSession.php +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ */ class DivingSession extends Model { protected $table = 'car_diving_session'; protected $table = 'CAR_DIVING_SESSION'; protected $primaryKey = 'DS_CODE'; protected $keyType = 'string'; public $timestamps = false; Loading