Add users relation to company model (#3032)
* fixes for invoice footer" * Add users relation to company model
This commit is contained in:
parent
2759fb4b72
commit
74f416cd2d
2 changed files with 8 additions and 1 deletions
|
|
@ -100,7 +100,9 @@ class Company extends BaseModel
|
|||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(CompanyUser::class);
|
||||
|
||||
return $this->hasManyThrough(User::class, CompanyUser::class, 'company_id', 'id', 'id', 'user_id');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -55,6 +55,11 @@ class CompanyUser extends Pivot
|
|||
return $this->hasOne(Company::class, 'id', 'company_id');
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class);
|
||||
}
|
||||
|
||||
/*todo monitor this function - may fail under certain conditions*/
|
||||
public function token()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue