I have created a simple search function that works by searching my required fields to match my keywords. This works fine for every column apart from my "Id" column, because when I display my ID in the table I actually add + 500 and some text. This is basically because the ID column is my booking/order reference and I didn't want to start at 0 and felt it easier to just offset the displayed result.
Basically I need it to add 500 to the search if when checking against the request_id column. So for the first record in the table would be 1 + 500 + my prefix which displays as SP-501. It I search for 501, it actually brings up record 501 in the table and not the correct one.
Heres my code:
public function search()
{
$search = \Request::get('search');
$bookings = LcsBooking::where('request_email','like','%'.$search.'%')
->orWhere('request_id', 'like', '%'.$search.'%')
->orWhere('request_name', 'like', '%'.$search.'%')
->orWhere('request_arrival', 'like', '%'.$search.'%')
->orWhere('request_return', 'like', '%'.$search.'%')
->orWhere('request_txauthno', 'like', '%'.$search.'%')
->orWhere('request_vehicle_reg', 'like', '%'.$search.'%')
->orWhere('request_mobile', 'like', '%'.$search.'%')
->orderBy('request_id', 'DESC')
->paginate(20);
return view('admin.lcs.search',compact('bookings'));
}