don't load disabled company #369

This commit is contained in:
denisdulici
2018-06-03 19:27:31 +03:00
parent aeef73ec65
commit e288a42da0
4 changed files with 20 additions and 8 deletions

View File

@ -204,6 +204,18 @@ class Company extends Eloquent
return Auth::user()->companies()->filter($input)->sortable($sort)->paginate($limit);
}
/**
* Scope to only include companies of a given enabled value.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param mixed $value
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeEnabled($query, $value = 1)
{
return $query->where('enabled', $value);
}
/**
* Sort by company name
*