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\Hopaddition; class HopAdditionController extends Controller { public function __construct() { $this->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'); }
}
|