Eshop-Laravel/app/Http/Controllers/MenuController.php

63 lines
1.1 KiB
PHP
Raw Normal View History

2019-10-18 09:25:37 +00:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\MenuRequest;
use App\Menu;
use Session;
class MenuController extends MainController
{
public function index()
{
return view('cms.cms-menu' , self::$data);
}
public function create()
{
return view('forms.addMenu' , self::$data);
}
public function store(MenuRequest $request)
{
Menu::save_new($request);
return redirect('cms/menu');
}
public function show($id)
{
self::$data['item'] = Menu::find_item($id);
return view('cms.delete-menu' , self::$data);
}
public function edit($id)
{
self::$data['menu'] = Menu::find_item($id);
return view('cms.cms-edit-menu' , self::$data);
}
public function update(MenuRequest $request, $id)
{
Menu::update_item($request,$id);
return redirect('cms/menu');
}
public function destroy($id)
{
Menu::destroy($id);
Session::flash('sm' , 'Menu Deleted');
return redirect('cms/menu');
}
}