style: Laravel Pint 코드 포맷팅 적용
- PSR-12 스타일 가이드 준수 - 302개 파일 스타일 이슈 자동 수정 - 코드 로직 변경 없음 (포맷팅만)
This commit is contained in:
@@ -12,22 +12,22 @@
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use SoftDeletes, BelongsToTenant, ModelTrait;
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id','code','name','unit','category_id',
|
||||
'tenant_id', 'code', 'name', 'unit', 'category_id',
|
||||
'product_type', // 라벨/분류용
|
||||
'attributes','description',
|
||||
'is_sellable','is_purchasable','is_producible','is_active',
|
||||
'created_by','updated_by'
|
||||
'attributes', 'description',
|
||||
'is_sellable', 'is_purchasable', 'is_producible', 'is_active',
|
||||
'created_by', 'updated_by',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'attributes' => 'array',
|
||||
'is_sellable' => 'boolean',
|
||||
'attributes' => 'array',
|
||||
'is_sellable' => 'boolean',
|
||||
'is_purchasable' => 'boolean',
|
||||
'is_producible' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
'is_producible' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
@@ -35,7 +35,10 @@ class Product extends Model
|
||||
];
|
||||
|
||||
// 분류
|
||||
public function category() { return $this->belongsTo(Category::class, 'category_id'); }
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class, 'category_id');
|
||||
}
|
||||
|
||||
// BOM (자기참조) — 라인 모델 경유
|
||||
public function componentLines()
|
||||
@@ -54,7 +57,7 @@ public function children()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
self::class, 'product_components', 'parent_product_id', 'child_product_id'
|
||||
)->withPivot(['quantity','sort_order','is_default'])
|
||||
)->withPivot(['quantity', 'sort_order', 'is_default'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
@@ -62,17 +65,39 @@ public function parents()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
self::class, 'product_components', 'child_product_id', 'parent_product_id'
|
||||
)->withPivot(['quantity','sort_order','is_default'])
|
||||
)->withPivot(['quantity', 'sort_order', 'is_default'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
// 파일 / 태그 (폴리모픽)
|
||||
public function files() { return $this->morphMany(File::class, 'fileable'); }
|
||||
public function tags() { return $this->morphToMany(Tag::class, 'taggable'); }
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
|
||||
// 스코프
|
||||
public function scopeType($q, string $type) { return $q->where('product_type', $type); }
|
||||
public function scopeSellable($q) { return $q->where('is_sellable', 1); }
|
||||
public function scopePurchasable($q) { return $q->where('is_purchasable', 1); }
|
||||
public function scopeProducible($q) { return $q->where('is_producible', 1); }
|
||||
public function scopeType($q, string $type)
|
||||
{
|
||||
return $q->where('product_type', $type);
|
||||
}
|
||||
|
||||
public function scopeSellable($q)
|
||||
{
|
||||
return $q->where('is_sellable', 1);
|
||||
}
|
||||
|
||||
public function scopePurchasable($q)
|
||||
{
|
||||
return $q->where('is_purchasable', 1);
|
||||
}
|
||||
|
||||
public function scopeProducible($q)
|
||||
{
|
||||
return $q->where('is_producible', 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user