MafView.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Models;
  3. use App\Models\Scopes\YearScope;
  4. use Illuminate\Database\Eloquent\Attributes\ScopedBy;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  7. #[ScopedBy([YearScope::class])]
  8. class MafView extends Model
  9. {
  10. const DEFAULT_SORT_BY = 'created_at';
  11. protected $fillable = [
  12. 'year',
  13. 'product_id',
  14. 'order_id',
  15. 'maf_order_id',
  16. 'status', // needs - нуждается в данном товаре, related - привязана к MafOrder
  17. 'rfid',
  18. 'factory_number',
  19. 'manufacture_date',
  20. 'statement_number',
  21. 'statement_date',
  22. 'upd_number',
  23. 'comment',
  24. 'passport_id',
  25. 'district_name',
  26. 'area_name',
  27. 'user_name',
  28. 'object_address',
  29. 'order_number',
  30. 'article',
  31. 'nomenclature_number',
  32. 'name_tz',
  33. 'type_tz',
  34. 'type',
  35. 'manufacturer_name',
  36. ];
  37. public $table = 'mafs_view';
  38. /**
  39. * @return BelongsTo
  40. */
  41. public function product(): BelongsTo
  42. {
  43. return $this->belongsTo(Product::class, 'product_id', 'id')->withoutGlobalScopes();
  44. }
  45. }