Schedule.php 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Models;
  3. use App\Models\Dictionary\Area;
  4. use App\Models\Dictionary\District;
  5. use Illuminate\Database\Eloquent\Factories\HasFactory;
  6. use Illuminate\Database\Eloquent\Model;
  7. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  8. class Schedule extends Model
  9. {
  10. use HasFactory;
  11. protected $fillable = [
  12. 'installation_date',
  13. 'address_code',
  14. 'manual',
  15. 'source',
  16. 'order_id',
  17. 'district_id',
  18. 'area_id',
  19. 'object_address',
  20. 'object_type',
  21. 'mafs',
  22. 'mafs_count',
  23. 'brigadier_id',
  24. 'comment',
  25. 'transport',
  26. 'admin_comment',
  27. ];
  28. public function district(): BelongsTo
  29. {
  30. return $this->belongsTo(District::class);
  31. }
  32. public function area(): BelongsTo
  33. {
  34. return $this->belongsTo(Area::class);
  35. }
  36. public function brigadier(): BelongsTo
  37. {
  38. return $this->belongsTo(User::class, 'brigadier_id', 'id');
  39. }
  40. }