| xqd
@@ -13,6 +13,7 @@ class Docter extends BaseModel
|
|
|
protected $casts = [
|
|
|
'label' => 'json',
|
|
|
];
|
|
|
+ protected $appends = ['is_collect'];
|
|
|
|
|
|
public function office()
|
|
|
{
|
| xqd
@@ -33,4 +34,16 @@ class Docter extends BaseModel
|
|
|
{
|
|
|
return $this->hasMany(Evaluate::class)->where('status', 2);
|
|
|
}
|
|
|
+
|
|
|
+ public function getIsCollectAttribute()
|
|
|
+ {
|
|
|
+ if (!empty(request()->header('token'))) {
|
|
|
+ $user = User::getUserByToken();
|
|
|
+ if (Collection::where('user_id', $user['id'])->where('docter_id', $this->id)->exists()) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|