In this installation page we'll show you the steps to install Auth inside of a new Filament application.
1. Create a new Filament application
After creating a new Laravel application, you'll want to follow the Filament install guides here. This will get you up and running with a new Filament application.
After installing Filament we can go through the basic install steps:
2. Install the Package
Install the Auth package via composer
3. Publish the Files
Publish the assets, configs, ci workflow, and migrations:
4. Run Migrations
Run the database migrations:
5. Extend the DevDojo User Model
Your default User model needs the methods that handle 2FA and Email Verification.
To do this we want extend the DevDojo User Model from your default App\Models\User.php, navigate to the App\Models\User.php file and add the following class to the top:
use Devdojo\Auth\Models\User as AuthUser;
and extend the AuthUser class:
class User extends AuthUser
Here is what your default User Model should look like:
<?php
namespace App\Models;
use Devdojo\Auth\Models\User as AuthUser;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends AuthUser
{
...
}
Enable the Name Field for Registration
The Filament admin panel utilizes the user name field, you'll want to enable this option in the setup page.
You can do that by visiting the /auth/setup route, clicking on Settings, and enabling the Registration Include Name Field option.
That's it! DevDojo Auth package is now successfully installed in your Filament application.