public function run()
 {
     $navigationAppPerms = array();
     foreach (range(1, 3) as $index) {
         $navigationAppPerms[] = array('category_id' => 1, 'navigation_app_id' => $index);
     }
     foreach ($navigationAppPerms as $navigationAppPerm) {
         NavigationAppPerm::create($navigationAppPerm);
     }
 }
Exemplo n.º 2
0
 /**
  * @return void
  */
 public function setupNav()
 {
     $perms = NavigationAppPerm::with(array('navigationApp' => function ($query) {
         $query->with('app');
     }))->where('category_id', $this->user->category_id)->get();
     $items = array();
     foreach ($perms as $perm) {
         $item = array();
         $item['name'] = $perm->navigationApp->app->name;
         $item['title'] = $perm->navigationApp->title;
         if (!is_null($perm->navigationApp->url)) {
             $item['url'] = $perm->navigationApp->url;
         }
         if (!is_null($perm->navigationApp->target)) {
             $item['url_target'] = $perm->navigationApp->target;
         }
         if (!is_null($perm->navigationApp->icon)) {
             $item['icon'] = $perm->navigationApp->icon;
         }
         if (!is_null($perm->navigationApp->label_htm)) {
             $item['label_htm'] = $perm->navigationApp->label_htm;
         }
         if (!is_null($perm->navigationApp->parent)) {
             $item['parent'] = $perm->navigationApp->parent;
         }
         $items[$perm->navigationApp->app->name] = $item;
     }
     if (count($items) > 1) {
         $items = $this->generateNav($items);
     }
     $this->page_nav = $items;
 }