|
@@ -1,13 +1,9 @@
|
|
|
-<?php namespace App\Http\Controllers\Auth;
|
|
|
+<?php namespace App\Http\Controllers;
|
|
|
|
|
|
-use Illuminate\Routing\Controller;
|
|
|
use Illuminate\Contracts\Auth\Guard;
|
|
|
use App\Http\Requests\Auth\LoginRequest;
|
|
|
use App\Http\Requests\Auth\RegisterRequest;
|
|
|
|
|
|
-/**
|
|
|
- * @Middleware("guest", except={"logout"})
|
|
|
- */
|
|
|
class AuthController extends Controller {
|
|
|
|
|
|
/**
|
|
@@ -26,16 +22,16 @@ class AuthController extends Controller {
|
|
|
public function __construct(Guard $auth)
|
|
|
{
|
|
|
$this->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 @@ class AuthController extends Controller {
|
|
|
/**
|
|
|
* 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 @@ class AuthController extends Controller {
|
|
|
/**
|
|
|
* Show the application login form.
|
|
|
*
|
|
|
- * @Get("auth/login")
|
|
|
- *
|
|
|
* @return Response
|
|
|
*/
|
|
|
- public function showLoginForm()
|
|
|
+ public function getLogin()
|
|
|
{
|
|
|
return view('auth.login');
|
|
|
}
|
|
@@ -72,12 +64,10 @@ class AuthController extends Controller {
|
|
|
/**
|
|
|
* 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 @@ class AuthController extends Controller {
|
|
|
/**
|
|
|
* Log the user out of the application.
|
|
|
*
|
|
|
- * @Get("auth/logout")
|
|
|
- *
|
|
|
* @return Response
|
|
|
*/
|
|
|
- public function logout()
|
|
|
+ public function getLogout()
|
|
|
{
|
|
|
$this->auth->logout();
|
|
|
|