removed an unncessary query

This commit is contained in:
Godfrey M 2023-04-06 13:06:05 -07:00
parent 55943d8897
commit 3d7c55deb3

View file

@ -77,12 +77,11 @@ class AccessoryCheckoutController extends Controller
'note' => $request->input('note'),
]);
$checkedout=DB::table('accessories_users')->where('accessory_id', '=', $accessory->id)->count();
$available= new Accessory();
if($checkedout >= $available->numRemaining()){
if($available->numRemaining()<=0){
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.checkout.unavailable'));
}