MafView.php 1.1 KB

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