Crew.php 606 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Crew extends Model
  6. {
  7. use HasFactory;
  8. protected $fillable = [
  9. 'staff_id',
  10. 'flight_id',
  11. 'staff_id',
  12. 'flight_id',
  13. 'commander'
  14. ];
  15. public function flight()
  16. {
  17. return $this->belongsTo('App\Models\Flight');
  18. }
  19. public function staff()
  20. {
  21. return $this->belongsTo('App\Models\Staff');
  22. }
  23. public function __toString(): string
  24. {
  25. return "{$this->staff} {$this->flight}";
  26. }
  27. }