35 lines
797 B
PHP
35 lines
797 B
PHP
<?php
|
||
|
||
namespace App\Models\business;
|
||
|
||
use App\BaseApp\BaseBusinessModel;
|
||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
||
/**
|
||
* 清单(cc_list)
|
||
*
|
||
* 一个小程序用户可以有多份清单,登录时会自动建一份「默认清单」。
|
||
*/
|
||
class ListModel extends BaseBusinessModel
|
||
{
|
||
protected $table = 'list';
|
||
|
||
protected $guarded = [];
|
||
|
||
public function items(): HasMany
|
||
{
|
||
return $this->hasMany(ListItemModel::class, 'list_id', 'id');
|
||
}
|
||
|
||
public function user(): BelongsTo
|
||
{
|
||
return $this->belongsTo(WxUserModel::class, 'user_id', 'id');
|
||
}
|
||
|
||
public function enterprise(): BelongsTo
|
||
{
|
||
return $this->belongsTo(EnterpriseModel::class, 'enterprise_id', 'id');
|
||
}
|
||
}
|