Fix Corporate Index
This commit is contained in:
@@ -23,10 +23,19 @@ class CorporateController extends Controller
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$corporates = Corporate::query()
|
||||
->paginate(0);
|
||||
->when($request->search, function ($query, $search) {
|
||||
return $query->where('name', 'LIKE', '%'.$search.'%');
|
||||
})
|
||||
->with('currentPolicy')
|
||||
->withCount([
|
||||
'employees',
|
||||
'corporatePlans',
|
||||
'corporateBenefits'
|
||||
])
|
||||
->paginate(2);
|
||||
|
||||
return $corporates;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user