Skip to content

Commit

Permalink
duplicate query
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Mar 6, 2021
1 parent 3a97c98 commit 7b9c9e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Common/Companies.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Companies extends Controller
*/
public function index()
{
$companies = Company::collect();
$companies = user()->companies()->collect();

return $this->response('common.companies.index', compact('companies'));
}
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Common/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function scopeCollect($query, $sort = 'name')

$search = $request->get('search');

$query = user()->companies()->usingSearchString($search)->sortable($sort);
$query->usingSearchString($search)->sortable($sort);

if ($request->expectsJson() && $request->isNotApi()) {
return $query->get();
Expand Down

0 comments on commit 7b9c9e8

Please sign in to comment.