Menu

## LoginController extends Controller
in package
implements ShouldQueue uses AuthenticatesUsers

LoginController.php : 15

### Table of Contents

#### Interfaces

ShouldQueue

#### Properties

$redirectTo : mixed
  Determine where to redirect users after login.

#### Methods

__construct() : void
  Create a new controller instance.
login() : RedirectResponse|Response|JsonResponse
  Handle a login request to the application.
logout() : Response
  Log the user out of the application.
showLoginForm() : View
  Display the login form.
username() : string
  Get the login username to be used by the controller.
attemptLogin() : bool
  Attempt to log the user into the application.
authenticated() : mixed
  The user has been authenticated.
credentials() : array<string|int, mixed>
  Get the needed authorization credentials from the request.
guard() : StatefulGuard
  Get the guard to be used during authentication.
loggedOut() : mixed
  The user has logged out of the application.
sendFailedLoginResponse() : Response
  Get the failed login response instance.
sendLoginResponse() : Response
  Send the response after the user was authenticated.
validateLogin() : void
  Validate the user login request.

### Properties

#### $redirectTo

LoginController.php : 40

Determine where to redirect users after login.

`protected mixed $redirectTo = '/admin/dashboard'`

Routes users based on their role (usergroup_id):

- Stock Keeper (ID 12) → /stock/dashboard
- All other roles → /admin/dashboard (then middleware handles role-specific routing)

### Methods

#### __construct()

LoginController.php : 48

Create a new controller instance.

`public __construct() : void`

#### login()

AuthenticatesUsers.php : 29

Handle a login request to the application.

`public login(Request $request) : RedirectResponse|Response|JsonResponse`

##### Parameters

$request : Request

##### Tags

throws
  ValidationException

##### Return values

RedirectResponse|Response|JsonResponse

#### logout()

AuthenticatesUsers.php : 234

Log the user out of the application.

`public logout(Request $request) : Response`

##### Parameters

$request : Request

##### Return values

Response

#### showLoginForm()

LoginController.php : 58

Display the login form.

`public showLoginForm() : View`

##### Return values

View

#### username()

AuthenticatesUsers.php : 220

Get the login username to be used by the controller.

`public username() : string`

Supports flexible login: users can login with either email or registration_number. Validates the input to determine which field to use.

##### Return values

string —

The field name ('email' or 'registration_number')

#### attemptLogin()

AuthenticatesUsers.php : 151

Attempt to log the user into the application.

`protected attemptLogin(Request $request) : bool`

##### Parameters

$request : Request

##### Return values

bool

#### authenticated()

AuthenticatesUsers.php : 192

The user has been authenticated.

`protected authenticated(Request $request, mixed $user) : mixed`

##### Parameters

$request : Request
$user : mixed

#### credentials()

AuthenticatesUsers.php : 164

Get the needed authorization credentials from the request.

`protected credentials(Request $request) : array<string|int, mixed>`

##### Parameters

$request : Request

##### Return values

array<string|int, mixed>

#### guard()

AuthenticatesUsers.php : 259

Get the guard to be used during authentication.

`protected guard() : StatefulGuard`

##### Return values

StatefulGuard

#### loggedOut()

AuthenticatesUsers.php : 249

The user has logged out of the application.

`protected loggedOut(Request $request) : mixed`

##### Parameters

$request : Request

#### sendFailedLoginResponse()

AuthenticatesUsers.php : 205

Get the failed login response instance.

`protected sendFailedLoginResponse(Request $request) : Response`

##### Parameters

$request : Request

##### Tags

throws
  ValidationException

##### Return values

Response

#### sendLoginResponse()

AuthenticatesUsers.php : 175

Send the response after the user was authenticated.

`protected sendLoginResponse(Request $request) : Response`

##### Parameters

$request : Request

##### Return values

Response

#### validateLogin()

AuthenticatesUsers.php : 66

Validate the user login request.

`protected validateLogin(Request $request) : void`

Registers custom validators:

- checkschool: Validates that the school is active
- checkusers: Validates that the user exists
- checkactive: Validates that the user is not suspended (inactive status)
- checkexit: Validates that the user has not exited (exit status)

##### Parameters

$request : Request

## Search results