also return container and file information through items endpoint

This commit is contained in:
j3d1 2019-12-05 13:05:44 +01:00
parent b978b2bc0b
commit 6f7dbddf92

View file

@ -17,13 +17,15 @@ class ItemController extends Controller
public function showByEvent($event) public function showByEvent($event)
{ {
$eid = Event::where('slug','=',$event)->first()->eid; $eid = Event::where('slug','=',$event)->first()->eid;
return response()->json(Item::where('eid','=',$eid)->get()); return response()->json(Item::where('eid','=',$eid)
->join('containers','item.cid','=','container.cid')
->leftJoin('files','item.iid','=','files.iid')
->get());
} }
public function searchByEvent($event, $query) public function searchByEvent($event, $query)
{ {
$eid = Event::where('slug','=',$event)->first()->eid; return showByEvent($event); //TODO actually search
return response()->json(Item::where('eid','=',$eid)->get()); //TODO actually search
} }
public function showOneItem($event, $id) public function showOneItem($event, $id)