Skip to content

Commit

Permalink
Update CompaniesController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Azelis authored Aug 13, 2023
1 parent a1cfa45 commit 07bafa9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/Http/Controllers/Api/CompaniesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function index(Request $request)
'name',
'phone',
'fax',
'email',
'created_at',
'updated_at',
'users_count',
Expand All @@ -49,6 +50,10 @@ public function index(Request $request)
$companies->where('name', '=', $request->input('name'));
}

if ($request->filled('email')) {
$companies->where('email', '=', $request->input('email'));
}


// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $companies->count()) ? $companies->count() : abs($request->input('offset'));
Expand Down Expand Up @@ -168,6 +173,7 @@ public function selectlist(Request $request)
$companies = Company::select([
'companies.id',
'companies.name',
'companies.email',
'companies.image',
]);

Expand Down

0 comments on commit 07bafa9

Please sign in to comment.