diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/AuthController.php similarity index 74% rename from app/Http/Controllers/Auth/AuthController.php rename to app/Http/Controllers/AuthController.php index 74de0291..2e9db4f7 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -1,13 +1,9 @@ -auth = $auth; + + $this->middleware('guest', ['except' => 'logout']); } /** * Show the application registration form. * - * @Get("auth/register") - * * @return Response */ - public function showRegistrationForm() + public function getRegister() { return view('auth.register'); } @@ -43,12 +39,10 @@ public function showRegistrationForm() /** * Handle a registration request for the application. * - * @Post("auth/register") - * * @param RegisterRequest $request * @return Response */ - public function register(RegisterRequest $request) + public function postRegister(RegisterRequest $request) { // Registration form is valid, create user... @@ -60,11 +54,9 @@ public function register(RegisterRequest $request) /** * Show the application login form. * - * @Get("auth/login") - * * @return Response */ - public function showLoginForm() + public function getLogin() { return view('auth.login'); } @@ -72,12 +64,10 @@ public function showLoginForm() /** * Handle a login request to the application. * - * @Post("auth/login") - * * @param LoginRequest $request * @return Response */ - public function login(LoginRequest $request) + public function postLogin(LoginRequest $request) { if ($this->auth->attempt($request->only('email', 'password'))) { @@ -92,11 +82,9 @@ public function login(LoginRequest $request) /** * Log the user out of the application. * - * @Get("auth/logout") - * * @return Response */ - public function logout() + public function getLogout() { $this->auth->logout(); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php new file mode 100644 index 00000000..d6abde91 --- /dev/null +++ b/app/Http/Controllers/Controller.php @@ -0,0 +1,10 @@ +get('/', 'HomeController@showWelcome'); | */ - /** - * @Get("/") - */ public function index() { return view('hello'); diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/PasswordController.php similarity index 81% rename from app/Http/Controllers/Auth/PasswordController.php rename to app/Http/Controllers/PasswordController.php index ee5aa569..266e4250 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/PasswordController.php @@ -1,13 +1,9 @@ -passwords = $passwords; + + $this->middleware('guest'); } /** * Display the form to request a password reset link. * - * @Get("password/email") - * * @return Response */ - public function showResetRequestForm() + public function getEmail() { return view('password.email'); } @@ -43,12 +39,10 @@ public function showResetRequestForm() /** * Send a reset link to the given user. * - * @Post("password/email") - * * @param Request $request * @return Response */ - public function sendResetLink(Request $request) + public function postEmail(Request $request) { switch ($response = $this->passwords->sendResetLink($request->only('email'))) { @@ -63,12 +57,10 @@ public function sendResetLink(Request $request) /** * Display the password reset view for the given token. * - * @Get("password/reset/{token}") - * * @param string $token * @return Response */ - public function showResetForm($token = null) + public function getReset($token = null) { if (is_null($token)) { @@ -81,12 +73,10 @@ public function showResetForm($token = null) /** * Reset the given user's password. * - * @Post("password/reset") - * * @param Request $request * @return Response */ - public function resetPassword(Request $request) + public function postReset(Request $request) { $credentials = $request->only( 'email', 'password', 'password_confirmation', 'token' diff --git a/app/Http/routes.php b/app/Http/routes.php new file mode 100644 index 00000000..ed631e25 --- /dev/null +++ b/app/Http/routes.php @@ -0,0 +1,30 @@ +get('/', 'HomeController@index'); + +/* +|-------------------------------------------------------------------------- +| Authentication & Password Reset Controllers +|-------------------------------------------------------------------------- +| +| These two controllers handle the authentication of the users of your +| application, as well as the functions necessary for resetting the +| passwords for your users. You may modify or remove these files +| if you wish. They just give you a convenient starting point. +| +*/ + +$router->controller('auth', 'AuthController'); + +$router->controller('password', 'PasswordController'); diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index ee3542ee..32695cf0 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -49,7 +49,10 @@ public function before(Router $router) */ public function map(Router $router) { - // require app_path('Http/routes.php'); + $router->group(['namespace' => 'App\Http\Controllers'], function($router) + { + require app_path('Http/routes.php'); + }); } }