Schedule.php 938 B

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