My Laravel project uses the following user types: students, parents, trainers. Now I would like to use Laravel Nova for the backend to manage the different resources.
Nova uses the users table, and model as default, however, I would like to use the admins table and model for the login.
I already created a custom admins table and model and updated the config/auth.php.
database/migrations/create_admins_table.php
...
public function up()
{
Schema::create('admins', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 60);
$table->string('email', 60)->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
config/auth.php
'guards' => [
...
'admins' => [
'driver' => 'session',
'provider' => 'admins',
],
],
'providers' => [
...
'admins' => [
'driver' => 'eloquent',
'model' => App\Admin::class,
],
],
What changes do I have to make to use the admins' table/guard for the Nova login?
In your /config folder, you'll find the file nova.php. Inside it, change the following line of code to specify your guard. For example:
'guard' => 'admins',
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With