'json', ]; protected $appends = ['is_collect']; public function office() { return $this->belongsTo(Office::class)->select(['id', 'name']); } public function qualification() { return $this->belongsTo(Qualification::class)->select(['id', 'name']); } public function organization() { return $this->belongsToMany(Organization::class); } public function evaluate() { 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; } }