/**
  * @param Resource $resource
  * @param null     $title
  * @param null     $color
  * @return mixed
  */
 public static function createWithPages(array $data, $title = null, $color = '#31b0d5')
 {
     $resource = Resource::create($data);
     if (!$title) {
         $title = $resource->title;
     }
     $pages = PageRepository::createResourcePages($title, $resource->controller, null, 'layouts.admin', $color);
     Event::fire('admin.model.resourceRepository.createWithPages', array($resource, $pages));
     return $pages;
 }
 public function boot()
 {
     Route::get('admin/resources/import/{class}', 'Boyhagemann\\Admin\\Controller\\ResourceController@import')->where('class', '(.*)');
     Route::get('admin/resources/scan', 'Boyhagemann\\Admin\\Controller\\ResourceController@scan');
     if (Schema::hasTable('resources')) {
         foreach (\Boyhagemann\Admin\Model\Resource::get() as $resource) {
             Route::resource($resource->url, $resource->controller);
         }
     }
     Route::filter('installed', function () {
         if (!Schema::hasTable('resources')) {
             Artisan::call('admin:install');
             return Redirect::to('admin');
         }
     });
     Route::when('admin/*', array('installed'));
     Route::when('*', array('blocks'));
 }