コード例 #1
0
 /**
  * Create the auth controller and resources.
  *
  * @param string          $directory
  * @param OutputInterface $output
  * 
  * @return $this
  */
 protected function createAuthController($directory, $output)
 {
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/controllers/AuthController.stub', $directory . '/app/controllers/AuthController.php');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/views/auth/login.blade.stub', $directory . '/app/views/auth/login.blade.php');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/views/auth/forgot.blade.stub', $directory . '/app/views/auth/forgot.blade.php');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/views/auth/reset.blade.stub', $directory . '/app/views/auth/reset.blade.php');
     File::appendOnce($directory . '/app/routes.php', File::get(dirname(__FILE__) . '/../stubs/app/routes.auth.partial'));
     if (File::exists($directory . '/app/views/layouts/default/navbar.blade.php')) {
         File::replace($directory . '/app/views/layouts/default/navbar.blade.php', "url_li('login', 'Log in')", "action_li('AuthController@getLogin', 'Log in')");
         File::replace($directory . '/app/views/layouts/default/navbar.blade.php', "url_li('logout', 'Logout')", "action_li('AuthController@getLogout', 'Logout')");
     }
     File::delete($directory . '/app/views/emails/auth/reminder.blade.php');
     File::copyIfNone(dirname(__FILE__) . '/../stubs/app/views/emails/auth/forgot.blade.stub', $directory . '/app/views/emails/auth/forgot.blade.php');
     $output->writeln('auth controller and resources installed');
     return $this;
 }
コード例 #2
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;
 }