hacky fix for duplicate items involving a SQL VIEW
This commit is contained in:
parent
b771a88bf8
commit
30fd018224
1 changed files with 4 additions and 4 deletions
|
@ -21,8 +21,8 @@ class ItemController extends Controller
|
||||||
$eid = Event::where('slug','=',$event)->first()->eid;
|
$eid = Event::where('slug','=',$event)->first()->eid;
|
||||||
return response()->json(Item::where('eid','=',$eid)
|
return response()->json(Item::where('eid','=',$eid)
|
||||||
->join('containers','items.cid','=','containers.cid')
|
->join('containers','items.cid','=','containers.cid')
|
||||||
->leftJoin('files','items.iid','=','files.iid')
|
->leftJoin('currentfiles','items.iid','=','currentfiles.iid')
|
||||||
->select('items.*','files.hash as file', 'containers.name as box')
|
->select('items.*','currentfiles.hash as file', 'containers.name as box')
|
||||||
->get());
|
->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ class ItemController extends Controller
|
||||||
$query_tokens = explode(" ",base64_decode ( $query , true));
|
$query_tokens = explode(" ",base64_decode ( $query , true));
|
||||||
$q = Item::where('eid','=',$eid)
|
$q = Item::where('eid','=',$eid)
|
||||||
->join('containers','items.cid','=','containers.cid')
|
->join('containers','items.cid','=','containers.cid')
|
||||||
->leftJoin('files','items.iid','=','files.iid')
|
->leftJoin('currentfiles','items.iid','=','currentfiles.iid')
|
||||||
->select('items.*','files.hash as file', 'containers.name as box');
|
->select('items.*','currentfiles.hash as file', 'containers.name as box');
|
||||||
foreach ($query_tokens as $token)
|
foreach ($query_tokens as $token)
|
||||||
$q = $q->where('items.description','like','%'.$token.'%');
|
$q = $q->where('items.description','like','%'.$token.'%');
|
||||||
return response()->json($q->get());
|
return response()->json($q->get());
|
||||||
|
|
Loading…
Reference in a new issue