diff --git a/app/Http/Controllers/SummarieController.php b/app/Http/Controllers/SummarieController.php index 02fd37a..21d142a 100644 --- a/app/Http/Controllers/SummarieController.php +++ b/app/Http/Controllers/SummarieController.php @@ -36,14 +36,14 @@ class SummarieController extends Controller 'og' => 'required', 'source' => 'required', 'batch' => 'required', + 'beer_id' => 'required', 'brewery_id' => 'required' ]); // create project $beer = new Summarie; - $lastID = Summarie::orderBy('beer_id','desc')->value('beer_id'); - $beer->beer_id = number_format($lastID) + 1; + $beer->beer_id = $request->input('beer_id') $beer->name = $request->input('name'); $beer->type = $request->input('type'); $beer->abv = $request->input('abv'); @@ -116,7 +116,10 @@ class SummarieController extends Controller } public function create() { - return view('beers.create'); + $lastID = Summarie::orderBy('beer_id','desc')->value('beer_id'); + $beer_id = number_format($lastID) + 1; + return view('beers.create')->with('beer_id', $beer_id); + } public function destroy($id) { diff --git a/resources/views/beers/create.blade.php b/resources/views/beers/create.blade.php index 6013897..208d29d 100644 --- a/resources/views/beers/create.blade.php +++ b/resources/views/beers/create.blade.php @@ -17,6 +17,9 @@
@csrf
+ + +