Loading app/Models/DivingGroup.php 0 → 100644 +26 −0 Original line number Diff line number Diff line <?php namespace App\Models; use Illuminate\Support\Facades\DB; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; class DivingGroup extends Model { protected $table = 'CAR_DIVING_GROUP'; use HasFactory; public function getDivers(){ $registrations = DivingSignUpModel::where('DS_CODE', $this->DS_CODE)->where('DG_NUMBER', $this->DG_NUMBER)->get(); $divers = []; foreach($registrations as $registration){ $divers[] = User::find($registration->US_ID); } return $divers; } } app/Models/DivingSession.php +4 −0 Original line number Diff line number Diff line Loading @@ -31,4 +31,8 @@ public function getParticipants(): array{ return $participants; } public function getDivingGroups(){ return DivingGroup::where('DS_CODE', $this->DS_CODE)->get(); } } app/Models/DivingSignUpModel.php +1 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,7 @@ class DivingSignUpModel extends Model { protected $table = 'car_registration'; protected $primaryKey = ['us_id', 'ds_code']; protected $keyType = ['int', 'string']; protected $fillable = ['US_ID', 'DS_CODE']; use HasFactory; } server.php +1 −1 Original line number Diff line number Diff line Loading @@ -18,4 +18,4 @@ return false; } require_once __DIR__.'/index.php'; require_once __DIR__.'/public/index.php'; Loading
app/Models/DivingGroup.php 0 → 100644 +26 −0 Original line number Diff line number Diff line <?php namespace App\Models; use Illuminate\Support\Facades\DB; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Factories\HasFactory; class DivingGroup extends Model { protected $table = 'CAR_DIVING_GROUP'; use HasFactory; public function getDivers(){ $registrations = DivingSignUpModel::where('DS_CODE', $this->DS_CODE)->where('DG_NUMBER', $this->DG_NUMBER)->get(); $divers = []; foreach($registrations as $registration){ $divers[] = User::find($registration->US_ID); } return $divers; } }
app/Models/DivingSession.php +4 −0 Original line number Diff line number Diff line Loading @@ -31,4 +31,8 @@ public function getParticipants(): array{ return $participants; } public function getDivingGroups(){ return DivingGroup::where('DS_CODE', $this->DS_CODE)->get(); } }
app/Models/DivingSignUpModel.php +1 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,7 @@ class DivingSignUpModel extends Model { protected $table = 'car_registration'; protected $primaryKey = ['us_id', 'ds_code']; protected $keyType = ['int', 'string']; protected $fillable = ['US_ID', 'DS_CODE']; use HasFactory; }
server.php +1 −1 Original line number Diff line number Diff line Loading @@ -18,4 +18,4 @@ return false; } require_once __DIR__.'/index.php'; require_once __DIR__.'/public/index.php';