Update CompaniesController.php

This commit is contained in:
Robert-Azelis 2023-08-13 17:15:20 +02:00 committed by GitHub
parent a1cfa45344
commit 07bafa9508
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,7 @@ class CompaniesController extends Controller
'name',
'phone',
'fax',
'email',
'created_at',
'updated_at',
'users_count',
@ -49,6 +50,10 @@ class CompaniesController extends Controller
$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'));
@ -168,6 +173,7 @@ class CompaniesController extends Controller
$companies = Company::select([
'companies.id',
'companies.name',
'companies.email',
'companies.image',
]);