middleware('auth'); } public function index() { $project = Hopaddition::orderBy('id')->get(); return view('hopadditions')->with('hopadditions', $project); } public function store(Request $request){ // validation $this->validate($request,[ 'beer_id' => 'required', 'hop_id' => 'required', 'amount' => 'required', 'timing' => 'required', ]); // create project $hop = new Hopaddition; $lastID = Hopaddition::orderBy('id','desc')->value('id'); $hop->id = number_format($lastID) + 1; $hop->beer_id = $request->input('beer_id'); $hop->hop_id = $request->input('hop_id'); $hop->amount = $request->input('amount'); $hop->timing = $request->input('timing'); $hop->save(); return redirect('/hopadditions')->with('success', 'Hop Addition Added'); } }