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); } public function cu() { return $this->hasOneThrough(CompanyUser::class, Company::class, 'id', 'company_id', 'company_id', 'id'); } }