From 59c245232bd1b332f1842073cc629574cbc90d67 Mon Sep 17 00:00:00 2001 From: Daniel Klamt Date: Sun, 22 Dec 2019 22:07:48 +0100 Subject: [PATCH] fix generation of item_uid --- app/Http/Controllers/ItemController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 8051802..52e8f6b 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -46,9 +46,10 @@ class ItemController extends Controller public function create($event, Request $request) { $eid = Event::where('slug','=',$event)->first()->eid; + $uid = Item::where('eid',$eid)->max('item_uid') + 1; $newitem = $request->except(['dataImage']); $newitem['eid'] = "".$eid; - $newitem['item_uid'] = "".rand(10, 100); + $newitem['item_uid'] = $uid; $newitem['wo'] = ""; $item = Item::create($newitem); $dataImage = $request->get('dataImage');