fix search bar
This commit is contained in:
parent
f8605673ff
commit
68e6f93068
|
@ -9,7 +9,8 @@ use App\Http\Requests\StoreVehicleRequest;
|
|||
use App\Http\Requests\UpdateVehicleRequest;
|
||||
use App\Models\VehicleClass;
|
||||
use App\Models\Vendor;
|
||||
use Schema;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class VehicleController extends Controller
|
||||
{
|
||||
|
@ -93,10 +94,7 @@ class VehicleController extends Controller
|
|||
if ($request->has('q')) {
|
||||
$search = $request->q;
|
||||
$games = Vehicle::select(['vehicle_name'])
|
||||
->where(function ($query) use ($search) {
|
||||
$query->where('name', 'LIKE', "%$search%")
|
||||
->orWhere('appID', 'LIKE', "%$search%");
|
||||
})
|
||||
->where('vehicle_name', 'LIKE', "%$search%")
|
||||
->get();
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class Vehicle extends Model
|
|||
): void {
|
||||
$search = $filters['search'] ?? false;
|
||||
if ($search) {
|
||||
$query->where('name', 'like', '%' . $search . '%');
|
||||
$query->where('vehicle_name', 'like', '%' . $search . '%');
|
||||
}
|
||||
|
||||
unset($filters['search']);
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
<h2>{{ __('Vehicles') }}</h2>
|
||||
<x-searchbar-select2 post="{{ route('vehicles') }}" inputClasses="w-[20rem]"
|
||||
autocomplete="{{ route('vehicles.autocomplete') }}"
|
||||
placeholder="Select Game or AppId" templateResult="true"
|
||||
templateSelection="true" text="item.name + '|AppID: ' + item.appID">
|
||||
placeholder="Select Vehicle" templateResult="true"
|
||||
templateSelection="true" text="item.vehicle_name">
|
||||
<x-select-dropdown-hover alpineVariable="vehicle_class_id" placeholder="Pick a Vehicle Class..."
|
||||
:enums="$vehicleClasses" functionCall="getVehicleClassName"/>
|
||||
<x-select-dropdown-hover alpineVariable="brand_id" placeholder="Pick a Brand..."
|
||||
|
|
Loading…
Reference in New Issue