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.2 KiB

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Mashe;
class MasheController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$project = Mashe::get();
return view('mashes')->with('mashes', $project);
}
public function store(Request $request){
// validation
$this->validate($request,[
'beer_id' => 'required',
'temperature' => 'required',
'duration' => 'required',
'stage' => 'required',
'boil' => 'required',
]);
// create project
$mashes = new Mashe;
$lastID = Mashe::orderBy('id','desc')->value('id');
$mashes->id = number_format($lastID) + 1;
$mashes->beer_id = $request->input('beer_id');
$mashes->temperature = $request->input('temperature');
$mashes->duration = $request->input('duration');
$mashes->stage = $request->input('stage');
$mashes->boil = $request->input('boil');
$mashes->save();
return redirect('/mashes')->with('success', 'Mash Step Added');
}
//
}