hasOne('App\Models\Client', 'id', 'client_id'); } public function created_by_info(){ return $this->hasOne('App\Models\Account', 'id', 'auth_user_id'); } // public function services(){ // return $this->hasMany('App\Models\Service', 'id', 'client_id'); // } protected $casts = [ 'services' => 'array', ]; public function getServiceNamesAttribute() { if (empty($this->services) || !is_array($this->services)) { return collect(); } return Service::whereIn('id', $this->services)->pluck('name'); } }