<?php Route::bind('page', function ($id) { return App\Menu::find($id)->pages()->get(); }); //user get('/', 'IndexController@index'); //admin get('/admin', 'AdminController@index'); get('admin/dashboard', 'AdminController@index'); //Menu get('admin/menus', 'MenuController@index'); post('admin/menus', 'MenuController@store'); post('admin/menus/update/{id}', 'MenuController@update'); get('admin/menus/delete/{id}', 'MenuController@delete'); //pages get('admin/pages/{page}', 'PagesController@index'); // Authentication routes... Route::get('auth/login', 'Auth\\AuthController@getLogin'); Route::post('auth/login', 'Auth\\AuthController@postLogin'); Route::get('auth/logout', 'Auth\\AuthController@getLogout'); // Registration routes... Route::get('auth/register', 'Auth\\AuthController@getRegister'); Route::post('auth/register', 'Auth\\AuthController@postRegister'); Route::controllers(['password' => 'Auth\\PasswordController']); //adding middleware //patch('/admin',[ // 'middleware' => 'auth', // 'uses' => 'AdminController@show' //]); //
<?php View::composer(Config("lara-cms.master.template_composer.menu"), function ($view) { $menu = Cache::remember('active_menu_' . App\Menu::getIdActiveMenu(), Config::get('lara-cms.eva.master.life_cache'), function () { $id = App\Menu::getIdActiveMenu(); $menuActive = App\Menu::find($id); $m = $menuActive->ancestorsAndSelf()->with('childs')->get(); $menu = array(); foreach ($m as $v) { $menu[] = $v->childs->toArray(); } return $menu; }); $view->with('menu', $menu); }); View::composer(Config("lara-cms.master.template_composer.list"), function ($view) { $page = new App\Page(); $list = $page->getParentFromMenu()->paginate(10); if ($list) { $list_pagin = []; $pages = ceil($list->total() / 10); for ($i = 1; $i <= $pages; $i++) { $list_pagin[] = array('number' => $i, 'url' => App\Page::updateUrlParametr(['page' => $i]), 'active' => $i == $list->currentPage() ? true : false); } } $view->with('list_pagin', $list_pagin); $view->with('list', $list); });