My beer compendium
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.
 
 
 
 
 
 

47 lines
1.3 KiB

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Adjunctaddition;
class AdjunctAdditionController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$project = Adjunctaddition::get();
return view('adjunctadditions')->with('adjunctadditions', $project);
}
public function store(Request $request){
// validation
$this->validate($request,[
'beer_id' => 'required',
'adjunct_id' => 'required',
'amount' => 'required',
'timing' => 'required',
]);
// create project
$adjunct = new Adjunctaddition;
$lastID = Adjunctaddition::orderBy('id','desc')->value('id');
$adjunct->id = number_format($lastID) + 1;
$adjunct->beer_id = $request->input('beer_id');
$adjunct->adjunct_id = $request->input('adjunct_id');
$adjunct->amount = $request->input('amount');
$adjunct->timing = $request->input('timing');
$adjunct->alternative = $request->input('alternative');
$adjunct->notes = $request->input('notes');
$adjunct->save();
return redirect('/adjunctadditions')->with('success', 'Adjunct Addition Added');
}
}