36 lines
905 B
PHP
36 lines
905 B
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
namespace App\Models\business;
|
|||
|
|
|
|||
|
|
use App\BaseApp\BaseBusinessModel;
|
|||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 商品图册(cc_catalogue)
|
|||
|
|
*
|
|||
|
|
* 老项目关系名写成 cateGory,序列化出来是 cate_gory,前端还得记这个拼写。
|
|||
|
|
* 新后端统一叫 category,列表里另外拍平成 category_name。
|
|||
|
|
*/
|
|||
|
|
class CatalogueModel extends BaseBusinessModel
|
|||
|
|
{
|
|||
|
|
protected $table = 'catalogue';
|
|||
|
|
|
|||
|
|
protected $guarded = [];
|
|||
|
|
|
|||
|
|
public function category(): BelongsTo
|
|||
|
|
{
|
|||
|
|
return $this->belongsTo(CategoryModel::class, 'category_id', 'id');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public function priceSheet(): HasMany
|
|||
|
|
{
|
|||
|
|
return $this->hasMany(PriceSheetModel::class, 'catalogue_id', 'id');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public function images(): HasMany
|
|||
|
|
{
|
|||
|
|
return $this->hasMany(ImageModel::class, 'catalogue_id', 'id');
|
|||
|
|
}
|
|||
|
|
}
|