## Middleware

LAP comes with some middleware classes out of the box in order to make using the package more seemless.

### AuthAdmin

This middleware will redirect the user to the admin login form if they are not logged in. It is similar to Laravel's `Auth` middleware, however, it uses a different redirect URL (sending to `admin/login` rather than just `login`).

### GuestAdmin

Once again, similar to the Laravel `Guest` middleware, except it will send them to `admin/dashboard` if they are logged in, rather than `home`.

### IntendUrl

This will set the `url.intended` session value to the current request URL. This is useful for the `Save & Go Back` buttons so that the user is appropriately redirected to their last page when clicked.

### NotAdminRole

Ensures that the request `id` does not belong to the admin role, mainly to prevent the deletion of it.

### NotSystemDoc

Similar to `NotAdminRole`, and is basically only used to prevent deleting the `Index` and `404` documentation pages.

### RestrictDemo

This middleware will restrict access to certain routes when demo mode is enabled. It runs on every request, and will only allow the whitelisted request methods or routes specified in `config/lap.php`.