Create Nova User on custom User table code example

Example: Create Nova User on custom User table

app/Providers/NovaServiceProvider.php

use Illuminate\Support\Facades\Hash;

public function boot()
{
  parent::boot();

  Nova::createUserUsing(function($command) {
    return [
      $command->ask('First Name'),
      $command->ask('Last Name'),
      $command->ask('Email Address'),
      $command->secret('Password'),
    ];
    }, function($first_name, $last_name, $email, $password) {
      (new User)->forceFill([
        'first_name' => $first_name,
        'last_name' => $last_name,
        'email' => $email,
        'password' => Hash::make($password),
        'email_verified_at' => now(),
      ])->save();
  });
}

Tags:

Misc Example