コード例 #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
 /**
  * Set app timezone to America/Chicago.
  *
  * @param string          $directory
  * @param OutputInterface $output
  * 
  * @return $this
  */
 protected function setTimezone($directory, $output)
 {
     File::replace($directory . '/app/config/app.php', "'timezone' => 'UTC',", "'timezone' => 'America/Chicago',");
     $output->writeln('app timezone set to America/Chicago');
     return $this;
 }
コード例 #3
0
 /**
  * Create the auth controller and resources.
  *
  * @param string          $directory
  * @param OutputInterface $output
  * 
  * @return $this
  */
 protected function createSignupController($directory, $output)
 {
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/controllers/SignupController.stub', $directory . '/app/controllers/SignupController.php');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/views/signup/index.blade.stub', $directory . '/app/views/signup/index.blade.php');
     File::appendOnce($directory . '/app/routes.php', File::get(dirname(__FILE__) . '/../stubs/app/routes.signup.partial'));
     if (File::exists($directory . '/app/views/layouts/default/navbar.blade.php')) {
         File::replace($directory . '/app/views/layouts/default/navbar.blade.php', "url_li('signup', 'Sign up')", "action_li('SignupController@getIndex', 'Sign up')");
     }
     $output->writeln('signup controller and resources installed');
     return $this;
 }