middleware('auth'); } public function index() { $project = Fermentation::get(); return view('fermentations')->with('fermentations', $project); } public function store(Request $request){ // validation $this->validate($request,[ 'beer_id' => 'required', 'yeast_id' => 'required', 'temperature' => 'required', 'duration' => 'required', ]); // create project $yeast = new Fermentations; $lastID = Fermentations::orderBy('id','desc')->value('id'); $yeast->id = number_format($lastID) + 1; $yeast->beer_id = $request->input('beer_id'); $yeast->yeast_id = $request->input('yeast_id'); $yeast->temperature = $request->input('temperature'); $yeast->duration = $request->input('duration'); if ($request->input('alternative')) { $yeast->alternative = $request->input('alternative'); } $yeast->save(); return redirect('/fermnentations')->with('success', 'Fermentation Step Added'); } }