The auth manager handles a users authentication status.
The easiest way to use the Auth Manager is to make sure your Controllers extend
Tomahawk\Routing\Controller. You then have access to it through
Otherwise just add the following parameter to the construct method of your Controller
Tomahawk\Auth\AuthInterface and it will get injected in through the Service Container.
Tomahawk ships with 3 Auth Handlers:
- Database - A simple handler using the Illuminate Database Component
- Eloquent - An Eloquent handler if the User Model is extending Illuminate's Eloquent Model
- Doctrine - When your using the Doctrine ORM
The config for Auth Manager can be found in the
and will look like the following.
Creating a User model
Your User class needs to implement the
You should have a model which looks something like the following:
To authenticate a user to pass the username and password to the
Manual Authentication With Extra Checks
You might want to also check other parts of the account:
Checking If User Is Logged In
Checking If User Is Guest
Logout A User
Getting The Logged In User
Logging Out The User
Automatically Logging In A Users
If you already have the user model you can pass this the the auth manager to log them in: