Schedule.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. public const SOURCE_PRODUCTION_ORDER = 'График заказов';
  12. protected $fillable = [
  13. 'installation_date',
  14. 'address_code',
  15. 'manual',
  16. 'source',
  17. 'order_id',
  18. 'production_order_installation_id',
  19. 'district_id',
  20. 'area_id',
  21. 'object_address',
  22. 'object_type',
  23. 'mafs',
  24. 'mafs_count',
  25. 'brigadier_id',
  26. 'comment',
  27. 'transport',
  28. 'admin_comment',
  29. ];
  30. public function district(): BelongsTo
  31. {
  32. return $this->belongsTo(District::class);
  33. }
  34. public function area(): BelongsTo
  35. {
  36. return $this->belongsTo(Area::class);
  37. }
  38. public function brigadier(): BelongsTo
  39. {
  40. return $this->belongsTo(User::class, 'brigadier_id', 'id');
  41. }
  42. public function productionOrderInstallation(): BelongsTo
  43. {
  44. return $this->belongsTo(ProductionOrderInstallation::class);
  45. }
  46. }