'fuzzy' search update
This commit is contained in:
parent
4505c43bdd
commit
906201313e
1 changed files with 6 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue