Commit c1a53660 authored by Nicolas Widart's avatar Nicolas Widart

Adding a form request object

parent c1aa0f26
......@@ -2,9 +2,21 @@
use Illuminate\Support\Facades\View;
use Modules\Core\Http\Controllers\Admin\AdminBaseController;
use Modules\Menu\Http\Requests\CreateMenuRequest;
use Modules\Menu\Repositories\MenuRepository;
class MenuController extends AdminBaseController
{
/**
* @var MenuRepository
*/
private $menu;
public function __construct(MenuRepository $menu)
{
parent::__construct();
$this->menu = $menu;
}
public function index()
{
return View::make('menu::admin.menus.index');
......@@ -15,8 +27,11 @@ class MenuController extends AdminBaseController
return View::make('menu::admin.menus.create');
}
public function store()
public function store(CreateMenuRequest $request)
{
dd('form posted');
$this->menu->create($request->all());
Flash::success('Menu created!');
return Redirect::route('dashboard.menu.index');
}
}
<?php namespace Modules\Menu\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateMenuRequest extends FormRequest
{
public function rules()
{
return [];
}
public function authorize()
{
return true;
}
public function messages()
{
return [];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment