Commit d544f14e authored by Nicolas Widart's avatar Nicolas Widart

Correcting editing links

parent 930ad2c0
<?php namespace Modules\Menu\Http\Controllers\Admin; <?php namespace Modules\Menu\Http\Controllers\Admin;
use Illuminate\Support\Facades\Redirect; use Illuminate\Http\Request;
use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\View;
use Laracasts\Flash\Flash; use Laracasts\Flash\Flash;
use Modules\Core\Http\Controllers\Admin\AdminBaseController; use Modules\Core\Http\Controllers\Admin\AdminBaseController;
use Modules\Menu\Entities\Menu;
use Modules\Menu\Http\Requests\CreateMenuRequest; use Modules\Menu\Http\Requests\CreateMenuRequest;
use Modules\Menu\Repositories\MenuRepository; use Modules\Menu\Repositories\MenuRepository;
...@@ -13,11 +14,16 @@ class MenuController extends AdminBaseController ...@@ -13,11 +14,16 @@ class MenuController extends AdminBaseController
* @var MenuRepository * @var MenuRepository
*/ */
private $menu; private $menu;
/**
* @var Request
*/
private $request;
public function __construct(MenuRepository $menu) public function __construct(MenuRepository $menu, Request $request)
{ {
parent::__construct(); parent::__construct();
$this->menu = $menu; $this->menu = $menu;
$this->request = $request;
} }
public function index() public function index()
...@@ -37,6 +43,11 @@ class MenuController extends AdminBaseController ...@@ -37,6 +43,11 @@ class MenuController extends AdminBaseController
$this->menu->create($request->all()); $this->menu->create($request->all());
Flash::success('Menu created!'); Flash::success('Menu created!');
return Redirect::route('dashboard.menu.index'); return $this->request->route('dashboard.menu.index');
}
public function edit(Menu $menu)
{
dd('editing menu');
} }
} }
...@@ -38,18 +38,18 @@ ...@@ -38,18 +38,18 @@
<?php foreach($menus as $menu): ?> <?php foreach($menus as $menu): ?>
<tr> <tr>
<td> <td>
<a href="{{ URL::route('dashboard.post.edit', [$menu->id]) }}"> <a href="{{ URL::route('dashboard.menu.edit', [$menu->id]) }}">
{{ $menu->name }} {{ $menu->name }}
</a> </a>
</td> </td>
<td> <td>
<a href="{{ URL::route('dashboard.post.edit', [$menu->id]) }}"> <a href="{{ URL::route('dashboard.menu.edit', [$menu->id]) }}">
{{ $menu->title }} {{ $menu->title }}
</a> </a>
</td> </td>
<td> <td>
<div class="btn-group"> <div class="btn-group">
<a href="{{ URL::route('dashboard.post.edit', [$menu->id]) }}" class="btn btn-default btn-flat"><i class="glyphicon glyphicon-pencil"></i></a> <a href="{{ URL::route('dashboard.menu.edit', [$menu->id]) }}" class="btn btn-default btn-flat"><i class="glyphicon glyphicon-pencil"></i></a>
<button class="btn btn-danger btn-flat" data-toggle="modal" data-target="#confirmation-{{ $menu->id }}"><i class="glyphicon glyphicon-trash"></i></button> <button class="btn btn-danger btn-flat" data-toggle="modal" data-target="#confirmation-{{ $menu->id }}"><i class="glyphicon glyphicon-trash"></i></button>
</div> </div>
</td> </td>
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('core::core.button.cancel') }}</button> <button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('core::core.button.cancel') }}</button>
{!! Form::open(['route' => ['dashboard.post.destroy', $menu->id], 'method' => 'delete', 'class' => 'pull-left']) !!} {!! Form::open(['route' => ['dashboard.menu.destroy', $menu->id], 'method' => 'delete', 'class' => 'pull-left']) !!}
<button type="submit" class="btn btn-danger btn-flat"><i class="glyphicon glyphicon-trash"></i> {{ trans('core::core.button.delete') }}</button> <button type="submit" class="btn btn-danger btn-flat"><i class="glyphicon glyphicon-trash"></i> {{ trans('core::core.button.delete') }}</button>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
......
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