ProductSKU.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. class ProductSKU extends Model
  7. {
  8. use SoftDeletes;
  9. const DEFAULT_SORT_BY = 'created_at';
  10. protected $fillable = [
  11. 'product_id',
  12. 'order_id',
  13. 'maf_order_id',
  14. 'status', // needs - нуждается в данном товаре, related - привязана к MafOrder
  15. 'rfid',
  16. 'factory_number',
  17. 'manufacture_date',
  18. 'service_life',
  19. 'certificate_number',
  20. 'certificate_date',
  21. 'certificate_issuer',
  22. 'certificate_type',
  23. ];
  24. public $table = 'products_sku';
  25. /**
  26. * @return BelongsTo
  27. */
  28. public function product(): BelongsTo
  29. {
  30. return $this->belongsTo(Product::class, 'product_id', 'id');
  31. }
  32. /**
  33. * @return BelongsTo
  34. */
  35. public function order(): BelongsTo
  36. {
  37. return $this->belongsTo(Order::class, 'order_id', 'id');
  38. }
  39. /**
  40. * @return BelongsTo
  41. */
  42. public function maf_order(): BelongsTo
  43. {
  44. return $this->belongsTo(MafOrder::class, 'maf_order_id', 'id');
  45. }
  46. }