mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
From the collection of users displayed just filtered the data with the method where() and concat() for the user can search for first name or last name. The solution is case sensitive.
This commit is contained in:
parent
652548957d
commit
0014ef054b
|
@ -132,7 +132,7 @@ class AccessoriesController extends Controller
|
|||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function checkedout($id)
|
||||
public function checkedout($id, Request $request)
|
||||
{
|
||||
$this->authorize('view', Accessory::class);
|
||||
|
||||
|
@ -143,6 +143,11 @@ class AccessoriesController extends Controller
|
|||
|
||||
$accessory->lastCheckoutArray = $accessory->lastCheckout->toArray();
|
||||
$accessory_users = $accessory->users;
|
||||
|
||||
if($request->filled('search')){
|
||||
$accessory_users = $accessory_users->where('first_name', $request->input('search'))->concat($accessory_users->where('last_name', $request->input('search')));
|
||||
}
|
||||
|
||||
$total = $accessory_users->count();
|
||||
|
||||
return (new AccessoriesTransformer)->transformCheckedoutAccessory($accessory, $accessory_users, $total);
|
||||
|
|
Loading…
Reference in a new issue