/**
  * @param Resource $resource
  * @param array    $pages
  */
 public function onCreatedResourcePages(array $pages)
 {
     $index = $pages['index'];
     $create = $pages['create'];
     $edit = $pages['edit'];
     $destroy = $pages['destroy'];
     foreach ($pages as $action => $page) {
         // Left menu root node
         $left = Node::create(array('title' => $page->title, 'page_id' => $page->id, 'container_id' => \NavigationContainersTableSeeder::LEFT));
         // Right menu root node
         $right = Node::create(array('title' => $page->title, 'page_id' => $page->id, 'container_id' => \NavigationContainersTableSeeder::RIGHT));
         $base = substr($page->alias, 0, strrpos($page->alias, '.'));
         switch ($action) {
             case 'index':
                 $left->children()->create(array('title' => 'Dashboard', 'page_id' => Page::whereAlias('admin.index')->first()->id, 'link_class' => 'btn btn-default'));
                 $right->children()->create(array('title' => $create->title, 'page_id' => $create->id, 'link_class' => 'btn btn-primary'));
                 break;
             case 'create':
                 $left->children()->create(array('title' => $index->title, 'page_id' => $index->id, 'link_class' => 'btn btn-default'));
                 break;
             case 'edit':
                 $left->children()->create(array('title' => $index->title, 'page_id' => $index->id, 'link_class' => 'btn btn-default'));
                 // Delete
                 $right->children()->create(array('title' => $destroy->title, 'page_id' => $destroy->id, 'link_class' => 'btn btn-danger'));
                 break;
         }
     }
 }
 /**
  * @param Model          $model
  * @param CrudController $controller
  */
 public function onSaved(Model $model, CrudController $controller)
 {
     // We are only interested in a resource controller
     if (!$controller instanceof ResourceController) {
         return;
     }
     // When the form is posted, we need this field.
     // If it is not checked, then we don't have to do anything.
     if (!Input::get('create_dashboard_navigation')) {
         return;
     }
     // Add a dashboard app pointing to the 'create' route of this resource
     Node::create(array('title' => sprintf('Create %s', Str::lower($model->title)), 'description' => Input::get('description'), 'page_id' => Page::whereAlias(sprintf('admin.%s.create', Str::slug($model->title)))->first()->id, 'icon_class' => 'icon-file', 'container_id' => NavigationContainersTableSeeder::DASHBOARD));
 }