Answers for "Create Nova User on custom User table"

0

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();
  });
}
Posted by: Guest on April-29-2021

Browse Popular Code Answers by Language