Total Complexity | 3 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class ProductSku extends Model |
||
10 | { |
||
11 | /** |
||
12 | * Table name of the model |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $table = 'product_skus'; |
||
17 | |||
18 | /** |
||
19 | * Disable the timestamp on model creation |
||
20 | * |
||
21 | * @var bool |
||
22 | */ |
||
23 | public $timestamps = false; |
||
24 | |||
25 | /** |
||
26 | * Fields that can be mass assigned |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $fillable = [ |
||
31 | 'product_id', 'code', 'price', 'cost' |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * Fields that are guarded during mass assign |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $guarded = [ |
||
40 | 'id' |
||
41 | ]; |
||
42 | |||
43 | /** |
||
44 | * Relation to the product |
||
45 | * |
||
46 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
47 | */ |
||
48 | public function product(): BelongsTo |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Product Variant |
||
55 | * |
||
56 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
57 | */ |
||
58 | public function variant(): HasMany |
||
59 | { |
||
60 | return $this->hasMany('Ronmrcdo\Inventory\Models\ProductVariant', 'product_sku_id'); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Product sku has many stocks |
||
65 | * |
||
66 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
67 | */ |
||
68 | public function stocks(): HasMany |
||
71 | } |
||
72 | } |
||
73 |