ProductSKU.php 892 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. 'status',
  14. 'rfid',
  15. 'factory_number',
  16. 'manufacture_date',
  17. 'service_life',
  18. 'certificate_number',
  19. 'certificate_date',
  20. 'certificate_issuer',
  21. 'certificate_type',
  22. ];
  23. public $table = 'products_sku';
  24. /**
  25. * @return BelongsTo
  26. */
  27. public function product(): BelongsTo
  28. {
  29. return $this->belongsTo(Product::class, 'product_id', 'id');
  30. }
  31. public function order(): BelongsTo
  32. {
  33. return $this->belongsTo(Order::class, 'order_id', 'id');
  34. }
  35. }