Schedule.php 868 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. 'address_code',
  12. 'manual',
  13. 'source',
  14. 'order_id',
  15. 'district_id',
  16. 'area_id',
  17. 'object_address',
  18. 'object_type',
  19. 'mafs',
  20. 'mafs_count',
  21. 'brigadier_id',
  22. 'comment',
  23. ];
  24. public function district(): BelongsTo
  25. {
  26. return $this->belongsTo(District::class);
  27. }
  28. public function area(): BelongsTo
  29. {
  30. return $this->belongsTo(Area::class);
  31. }
  32. public function brigadier(): BelongsTo
  33. {
  34. return $this->belongsTo(User::class, 'brigadier_id', 'id');
  35. }
  36. }