Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $pizza = Pizza::create($input);
     $pizza->ingredients()->attach($input['ingredients']);
     return redirect('pizzas');
 }
Ejemplo n.º 2
0
 /**
  * Delete pizza
  *
  * @param Request $request
  * @param Pizza $pizza
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  * @throws \Exception
  */
 public function destroy(Request $request, Pizza $pizza)
 {
     $pizza->delete();
     return redirect('/pizza');
 }
Ejemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Pizza::create(['ime' => 'Capriciossa']);
     Pizza::create(['ime' => 'Venezia']);
     Pizza::create(['ime' => 'Margarita']);
 }