From 30fd01822436dc9feaca90c2adc756cf4a874e23 Mon Sep 17 00:00:00 2001 From: jedi Date: Fri, 27 Dec 2019 02:19:17 +0100 Subject: [PATCH] hacky fix for duplicate items involving a SQL VIEW --- app/Http/Controllers/ItemController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 34f8dfe..a377fc1 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -21,8 +21,8 @@ class ItemController extends Controller $eid = Event::where('slug','=',$event)->first()->eid; return response()->json(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') + ->leftJoin('currentfiles','items.iid','=','currentfiles.iid') + ->select('items.*','currentfiles.hash as file', 'containers.name as box') ->get()); } @@ -32,8 +32,8 @@ class ItemController extends Controller $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'); + ->leftJoin('currentfiles','items.iid','=','currentfiles.iid') + ->select('items.*','currentfiles.hash as file', 'containers.name as box'); foreach ($query_tokens as $token) $q = $q->where('items.description','like','%'.$token.'%'); return response()->json($q->get());