Order.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 Order extends Model
  8. {
  9. protected $fillable = [
  10. 'user_id',
  11. 'district_id',
  12. 'area_id',
  13. 'object_address',
  14. 'object_type_id',
  15. 'contract_date',
  16. 'contract_number',
  17. 'comment',
  18. 'installation_date',
  19. 'brigadier_id',
  20. 'order_status_id',
  21. 'tg_group_name',
  22. 'tg_group_link',
  23. ];
  24. public function manager(): BelongsTo
  25. {
  26. return $this->belongsTo(User::class, 'user_id', 'id');
  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 objectType(): BelongsTo
  37. {
  38. return $this->belongsTo(ObjectType::class);
  39. }
  40. public function brigadier(): BelongsTo
  41. {
  42. return $this->belongsTo(Brigadier::class);
  43. }
  44. public function orderStatus(): BelongsTo
  45. {
  46. return $this->belongsTo(OrderStatus::class);
  47. }
  48. }