keskonmange/app/Http/Controllers/MenuController.php
Olivier DOSSMANN e3eb880368 Menus : création possible via un formulaire. fixes #2
* ajout d'un lien "nouveau" sur la liste des menus
* création d'un formulaire de création d'un menu
* enregistrement du menu
2021-04-28 19:06:03 +02:00

90 lines
1.8 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Menu;
use Illuminate\Http\Request;
class MenuController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('menus.index')
->with('menus', Menu::get()
->random(7)
->shuffle());
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view('menus.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
Menu::create($request->only(['title']));
return redirect()->route('menus.index');
}
/**
* Display the specified resource.
*
* @param \App\Models\Menu $menu
* @return \Illuminate\Http\Response
*/
public function show(Menu $menu)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Menu $menu
* @return \Illuminate\Http\Response
*/
public function edit(Menu $menu)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Menu $menu
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Menu $menu)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Menu $menu
* @return \Illuminate\Http\Response
*/
public function destroy(Menu $menu)
{
//
}
}