belongsTo(Account::class); } public function user() { return $this->belongsTo(User::class); } public function company() { return $this->belongsTo(Company::class); } public function company_user() { return $this->hasOne(CompanyUser::class, 'user_id', 'user_id') ->where('company_id', $this->company_id) ->where('user_id', $this->user_id); } }