コード例 #1
0
 /**
  * Configure the controllers and views.
  *
  * @param string          $directory
  * @param OutputInterface $output
  * 
  * @return $this
  */
 protected function configureMVC($directory, $output)
 {
     File::delete($directory . '/app/controllers/HomeController.php');
     File::delete($directory . '/app/views/hello.php');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/controllers/IndexController.stub', $directory . '/app/controllers/IndexController.php');
     File::put($directory . '/app/controllers/BaseController.php', File::get(dirname(__FILE__) . '/../stubs/app/controllers/BaseController.stub'));
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/views/index/index.blade.stub', $directory . '/app/views/index/index.blade.php');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/views/error/index.blade.stub', $directory . '/app/views/error/index.blade.php');
     File::mkdir($directory . '/public/assets/css/controllers');
     File::mkdir($directory . '/public/assets/js/controllers');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/public/assets/css/controllers/index/index.stub', $directory . '/public/assets/css/controllers/index/index.less');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/public/assets/js/controllers/index/index.stub', $directory . '/public/assets/js/controllers/index/index.js');
     File::replace($directory . '/app/routes.php', "Route::get('/', function()\n{\n\treturn View::make('hello');\n});", "Route::get('/', 'IndexController@getIndex');\nRoute::controller('index', 'IndexController');");
     $output->writeln('mvc configured');
     return $this;
 }
コード例 #2
0
 /**
  * Configure response headers in after filter.
  *
  * @param string          $directory
  * @param OutputInterface $output
  * 
  * @return $this
  */
 protected function configureResponseHeaders($directory, $output)
 {
     File::appendOnce($directory . '/app/filters.php', File::get(dirname(__FILE__) . '/../stubs/app/filters.headers.partial'));
     $output->writeln('response headers support added');
     return $this;
 }
コード例 #3
0
 /**
  * Install ACL functionality.
  *
  * @param string          $directory
  * @param OutputInterface $output
  * 
  * @return $this
  */
 protected function installAcl($directory, $output)
 {
     if (!File::has($directory . '/composer.json', 'zendframework/zend-permissions-acl')) {
         $output->writeln('<info>Installing zendframework/zend-permissions-acl...</info>');
         exec('composer require zendframework/zend-permissions-acl:2.2.6', $out);
         echo implode("\n", $out) . "\n";
     }
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/classes/Acl.stub', $directory . '/app/classes/Acl.php');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/config/acl.stub', $directory . '/app/config/acl.php');
     File::appendOnce($directory . '/app/start/global.php', File::get(dirname(__FILE__) . '/../stubs/app/start/global.acl.partial'));
     File::appendOnce($directory . '/app/filters.php', File::get(dirname(__FILE__) . '/../stubs/app/filters.acl.partial'));
     $output->writeln('acl installed');
     return $this;
 }