middleware('auth'); } public function index() { $yeasts = Yeast::orderBy('name')->get(); return view('yeasts')->with('yeasts', $yeasts); } public function store(Request $request){ // validation $this->validate($request,[ 'name' => 'required', ]); // create project $yeast = new Yeast; $lastID = Yeast::orderBy('id','desc')->value('id'); $yeast->id = number_format($lastID) + 1; $yeast->name = $request->input('name'); if ($request->input('attenuation')) { $yeast->attenuation = $request->input('attenuation'); } if ($request->input('flocculation')) { $yeast->flocculation = $request->input('flocculation'); } if ($request->input('profile')) { $yeast->profile = '{'.$request->input('profile').'}'; } if ($request->input('tolerance')) { $yeast->tolerance = $request->input('tolerance'); } if ($request->input('temp_range')) { $yeast->temp_range = $request->input('temp_range'); } $yeast->save(); return redirect('/yeasts')->with('success', 'Yeast Added'); } }