'fuzzy' search update

This commit is contained in:
j3d1 2019-12-26 20:21:40 +01:00
parent 4505c43bdd
commit 906201313e

View file

@ -29,12 +29,14 @@ class ItemController extends Controller
public function searchByEvent($event, $query)
{
$eid = Event::where('slug','=',$event)->first()->eid;
return response()->json(Item::where('eid','=',$eid)
$query_tokens = explode(" ",base64_decode ( $query , true));
$q = Item::where('eid','=',$eid)
->join('containers','items.cid','=','containers.cid')
->leftJoin('files','items.iid','=','files.iid')
->select('items.*','files.hash as file', 'containers.name as box')
->where('items.description', 'like' , '%'.base64_decode ( $query , true).'%')
->get());
->select('items.*','files.hash as file', 'containers.name as box');
foreach ($query_tokens as $token)
$g = $q->where('items.description','like','%'.$token.'%');
return response()->json($q->get());
}
public function showOneItem($event, $id)