后端: - 4个迁移文件新增23张业务表 - 23个Eloquent Model(含关联/类型转换/门店隔离) - 20个Controller(含CRUD+业务操作: 合同审核/入住退房/护理异常处理等) - 110+条API路由(crm/room/care/meal四大前缀) 前端: - 4个API模块(crm.js/room.js/care.js/meal.js) - 13个业务页面(线索/客户/合同/渠道/投诉/房型/房间/预定/护理档案/护理计划/护理记录/菜品/排餐)
54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Crm;
|
|
|
|
use App\Models\User;
|
|
use App\Traits\BelongsToStore;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Lead extends Model
|
|
{
|
|
use BelongsToStore;
|
|
|
|
protected $fillable = [
|
|
'store_id', 'channel_id', 'name', 'phone', 'wechat',
|
|
'expected_date', 'source', 'status', 'owner_id',
|
|
'remark', 'created_by',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'expected_date' => 'date',
|
|
'status' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function channel(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Channel::class);
|
|
}
|
|
|
|
public function owner(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'owner_id');
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function follows(): HasMany
|
|
{
|
|
return $this->hasMany(LeadFollow::class);
|
|
}
|
|
|
|
public function customer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Customer::class);
|
|
}
|
|
}
|