fix : Category, Product 관련 테이블 정리 (Models, DB, seeder)
This commit is contained in:
30
app/Models/Products/ProductComponent.php
Normal file
30
app/Models/Products/ProductComponent.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Products;
|
||||
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ProductComponent extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
||||
|
||||
protected $table = 'product_components';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id','parent_product_id','child_product_id',
|
||||
'quantity','sort_order','is_default',
|
||||
'created_by','updated_by'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'quantity' => 'decimal:4',
|
||||
'sort_order' => 'integer',
|
||||
'is_default' => 'boolean',
|
||||
];
|
||||
|
||||
public function parent() { return $this->belongsTo(Product::class, 'parent_product_id'); }
|
||||
public function child() { return $this->belongsTo(Product::class, 'child_product_id'); }
|
||||
}
|
||||
Reference in New Issue
Block a user