25 lines
500 B
PHP
25 lines
500 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\User;
|
|
|
|
class Agency extends Model
|
|
{
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class)->withDefault();
|
|
}
|
|
|
|
//业务员
|
|
public function salesman()
|
|
{
|
|
return $this->belongsTo(User::class, 'salesman_id', 'id')->withDefault();
|
|
}
|
|
|
|
protected function getStatusTextAttribute()
|
|
{
|
|
return $this->status == 1 ? "<span style='color:green'>正常</span>" : "<span style='color:red'>关闭</span>";
|
|
}
|
|
}
|