File manager - Edit - /var/www/html/spdc/api/app/Models/Schedule.php
Back
<?php namespace App\Models; use App\Casts\Boolean; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Concerns\HasUuids; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class Schedule extends Model { use HasFactory; use HasUuids; protected $fillable = [ 'type', 'date', 'exit_time', 'driver_id', 'note', 'emergency', 'transportation_id', ]; protected $casts = [ 'date' => 'date', 'exit_time' => 'datetime', 'emergency' => Boolean::class ]; /** * Get the transportation that owns the Schedule * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function transportation(): BelongsTo { return $this->belongsTo(Transportation::class); } /** * The occurrencies that belong to the Schedule * * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function occurrencies(): BelongsToMany { return $this->belongsToMany(Occurrency::class, 'schedule_occurrencies', 'schedule_id', 'occurrency_id')->withPivot('finished'); } /** * Get the extra associated with the Schedule * * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function extra(): HasOne { return $this->hasOne(ExtraSchedule::class); } /** * Get all of the agents for the Schedule * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function agents(): HasMany { return $this->hasMany(ScheduleAgent::class); } /** * Get the request associated with the Schedule * * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function request(): HasOne { return $this->hasOne(ScheduleRequest::class); } /** * Get all of the bdts for the Schedule * * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function bdt(): HasOne { return $this->hasOne(BDT::class); } /** * Get all of the supplies for the Schedule * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function supplies(): HasMany { return $this->hasMany(TransportationSupply::class); } /** * Get the driver that owns the Schedule * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function driver(): BelongsTo { return $this->belongsTo(User::class, 'driver_id'); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings