middleware('auth'); } /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function index() { return view('edit'); } public function gstore(Request $request){ // validation $this->validate($request,[ 'name' => 'required', ]); // create project $grain = new Grainbill; $lastID = Grainbill::orderBy('id','desc')->value('id'); $grain->id = number_format($lastID) + 1; $grain->name = $request->input('name'); if ($request->input('flavour')) { $grain->flavour = $request->input('flavour'); } if ($request->input('lintner')) { $grain->lintner = $request->input('lintner'); } if ($request->input('winkol')) { $grain->winkol = $request->input('winkol'); } if ($request->input('lovibond')) { $grain->lovibond = $request->input('lovibond'); } if ($request->input('colour')) { $grain->colour = $request->input('colour'); } if ($request->input('alternative')) { $altArr = array_map('intval',explode(',',$request->input('alternative'))); $grain->alternative = $altArr; } if ($request->input('ebc')) { $grain->ebc = $request->input('ebc'); } $grain->save(); return redirect('/edit')->with('success', 'Grain Bill Added'); } }