49 lines
1001 B
PHP
49 lines
1001 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class CrmUserLog extends Base
|
|
{
|
|
protected $fillable = [];
|
|
protected $guarded = [];
|
|
|
|
public function role()
|
|
{
|
|
return $this->hasOne(CrmRole::class, 'id', 'role_id');
|
|
}
|
|
|
|
public function roleUser()
|
|
{
|
|
return $this->hasOne(User::class, 'id', 'role_user_id');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->hasOne(User::class, 'id', 'user_id');
|
|
}
|
|
|
|
public function roleWechat()
|
|
{
|
|
return $this->hasOne(Wechat::class, 'user_id', 'role_user_id');
|
|
}
|
|
|
|
public function crmUser()
|
|
{
|
|
return $this->hasOne(CrmUser::class, 'user_id', 'user_id');
|
|
}
|
|
|
|
public function crmEndTime()
|
|
{
|
|
//最终备注时间
|
|
return ($this->f_commented_at)?null:$this->commented_at;
|
|
}
|
|
public function comments()
|
|
{
|
|
return $this->hasMany(ClientComment::class, 'user_id', 'user_id')->whereIn('type', ['crm', 'crm_t']);
|
|
}
|
|
|
|
|
|
}
|