You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request; use App\Models\Grainbill;
class EditController extends Controller { /** * Create a new controller instance. * * @return void */ public function __construct() { $this->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'); }
}
|