hasOne(Profile::class, 'user_id'); } public function user_profile() { return $this->hasOne(Profile::class, 'user_id'); } public function userProfile() { return $this->hasOne(Profile::class, 'user_id'); } public function getFullNameAttribute() { if (! $this->profile) { return; } return "{$this->profile['first_name']} {$this->profile['last_name']}"; } public function getPositionAttribute() { if (! $this->profile) { return; } return "{$this->profile->latitude} {$this->profile->longitude}"; } public function tags() { return $this->belongsToMany(Tag::class, 'test_user_tags', 'user_id', 'tag_id'); } }