public function createDefaultNavigation() { $top = Menu::create(array('name' => 'top', 'alias' => 'top', 'path' => '')); $top->save(); $left = Menu::create(array('name' => 'left', 'alias' => 'left', 'path' => '')); $left->save(); Menu::create(array('parent_id' => $top->id, 'name' => 'Dashboard', 'alias' => 'dashboard-top', 'path' => '/', 'order' => -99999))->save(); $settings = Menu::create(array('parent_id' => $top->id, 'name' => 'Settings', 'alias' => 'users', 'path' => '', 'order' => 1)); $settings->save(); Menu::create(array('parent_id' => $settings->id, 'name' => 'Manage Users', 'alias' => 'manage-users', 'path' => 'users'))->save(); Menu::create(array('parent_id' => $settings->id, 'name' => 'Manage Permissions', 'alias' => 'manage-permissions', 'path' => 'permissions'))->save(); Menu::create(array('parent_id' => $top->id, 'name' => 'Developer', 'alias' => 'developer', 'path' => '', 'order' => 2))->save(); Menu::create(array('parent_id' => $left->id, 'name' => 'Dashboard', 'alias' => 'dashboard-left', 'path' => '/', 'icon' => 'dashboard', 'order' => -99999))->save(); $blog = Menu::create(array('parent_id' => $left->id, 'name' => 'Blog', 'alias' => 'blog', 'path' => '', 'icon' => 'book')); $blog->save(); Menu::create(array('parent_id' => $blog->id, 'name' => 'Catagories', 'alias' => 'blog-categories', 'path' => 'blog/categories'))->save(); Menu::create(array('parent_id' => $blog->id, 'name' => 'Posts', 'alias' => 'blog-posts', 'path' => 'blog/posts'))->save(); }
$path = URL::to(Config::get('spratly::spratly.prefix') . '/' . $menu->path); if (!empty($menu->path)) { ?> <li><a href="<?php echo $path; ?> "><i class="icon-<?php echo $menu->icon; ?> icon-large"></i> <?php echo $menu->name; ?> </a></li> <?php } else { $children = Menu::where('parent_id', '=', $menu->id)->where('enabled', '=', 1)->get(); ?> <li class="accordion-group"> <a data-parent="#menu" data-toggle="collapse" class="accordion-toggle" data-target="#<?php echo $menu->alias; ?> -nav"> <i class="icon-<?php echo $menu->icon; ?> icon-large"></i> <?php echo $menu->name; ?> <span class="label label-inverse pull-right"><?php echo count($children); ?>
<?php /** * User: rgv151 * Date: 6/10/13 * Time: 1:59 AM */ namespace Rgv151\Spratly; use Carbon\Carbon; use Session; use View; use Auth; View::composer('spratly::*', function ($view) { $view->authUser = Auth::user(); $view->menus = Menu::all(); $view->message = Session::get('message'); }); View::composer('spratly::dashboard', function ($view) { $view->icon = 'dashboard'; $view->title = 'Dashboard'; }); View::composer('spratly::user.form', function ($view) { $view->icon = 'edit'; $view->title = 'Edit User'; });