mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
Filter scope to company
This commit is contained in:
parent
fd8c19d911
commit
d2e5563dbe
@ -167,12 +167,11 @@ class ClientFilters extends QueryFilters
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
$entity = strtolower(class_basename(Client::class));
|
||||
public function entityFilter()
|
||||
{
|
||||
|
||||
return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
||||
|
||||
$this->builder->where($entity .'.company_id', '=', auth()->user()->company()->id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -61,6 +61,8 @@ abstract class QueryFilters
|
||||
{
|
||||
$this->builder = $builder;
|
||||
|
||||
$this->entityFilter();
|
||||
|
||||
foreach ($this->filters() as $name => $value) {
|
||||
if (! method_exists($this, $name)) {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user