Commit 9f6717c2 authored by Nicolas Widart's avatar Nicolas Widart

Adding the update menu

parent ce5be8bb
......@@ -7,6 +7,7 @@ use Laracasts\Flash\Flash;
use Modules\Core\Http\Controllers\Admin\AdminBaseController;
use Modules\Menu\Entities\Menu;
use Modules\Menu\Http\Requests\CreateMenuRequest;
use Modules\Menu\Http\Requests\UpdateMenuRequest;
use Modules\Menu\Repositories\MenuRepository;
class MenuController extends AdminBaseController
......@@ -52,6 +53,14 @@ class MenuController extends AdminBaseController
return View::make('menu::admin.menus.edit', compact('menu'));
}
public function update(Menu $menu, UpdateMenuRequest $request)
{
$this->menu->update($menu, $request->all());
Flash::success('Menu updated!');
return $this->redirector->route('dashboard.menu.index');
}
public function destroy(Menu $menu)
{
$this->menu->destroy($menu);
......
......@@ -2,5 +2,8 @@
class MenuItemController
{
public function update()
{
dd('ok?');
}
}
<?php namespace Modules\Menu\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateMenuRequest extends FormRequest
{
public function rules()
{
return [];
}
public function authorize()
{
return true;
}
public function messages()
{
return [];
}
}
......@@ -18,4 +18,13 @@ class EloquentMenuRepository extends EloquentBaseRepository implements MenuRepos
return $menu;
}
public function update($menu, $data)
{
$translatableData = Helper::separateLanguages($data);
Helper::updateTranslated($menu, $translatableData);
return $menu;
}
}
......@@ -16,7 +16,7 @@
@stop
@section('content')
{!! Form::open(['route' => ['dashboard.menu.update'], 'method' => 'post']) !!}
{!! Form::open(['route' => ['dashboard.menu.update', $menu->id], 'method' => 'put']) !!}
<div class="row">
<div class="col-md-6">
......
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