6
0
Fork 0
jiqu-library-server/app/Models/ProductPart.php

44 lines
716 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductPart extends Model
{
use Concerns\HasShowable;
use HasFactory;
/**
* @var array
*/
protected $attributes = [
'is_show' => false,
];
/**
* @var array
*/
protected $fillable = [
'key',
'name',
'is_show',
];
/**
* @var array
*/
protected $casts = [
'is_show' => 'bool',
];
/**
* 属于此分区的商品
*/
public function skus()
{
return $this->belongsToMany(ProductSku::class, ProductPartSku::class, 'part_id', 'sku_id');
}
}