Argument 1 passed to App\Notifications\NewUser::__construct() must be an instance of App\Notifications\User, instance of App\User given, called in /var/www/html/adminApprove/app/Http/Controllers/Auth/RegisterController.php on line 76
help me
Call to undefined method App\Notifications\NewUser::via()
this is my Controllerregister.php
...
use App\Notifications\NewUser;
...
$user = User::create([
'name' => $data['name'],
'prenom' => $data['prenom'],
'matricule' => $data['matricule'],
'fonction' => $data['fonction'],
'emploi' => $data['emploi'],
// recup id
//'id_role'=> $data['role'],
'id_str'=> $id_str,
'id_direct'=> $id_direct,
'id_ser'=> $id_ser,
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
$admin = User::where('email', 'dogosidik@gmail.com')->first();
if ($admin) {
$admin->notify(new NewUser($user));
}
return $user;
}
NewUser.php
class NewUser extends Notification
{
use Queueable;
private $new_user;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct(User $new_user)
{
$this->new_user = $new_user;
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('Un nouvel utilisateur a été enregistré par email' .$this->new_user->email)
->action('Approve user', route('admin.users', $this->new_user->id));
}
Argument 1 passed to App\Notifications\NewUser::__construct() must be an instance of App\Notifications\User, instance of App\User given, called in C:\xampp\htdocs\staffPortal\app\Http\Controllers\Auth\RegisterController.php on line 75
in admin page not showing user that need to approve, and after register notification application not send approval button to admin email. what is missing ?
in admin page not showing user that need to approve, and after register notification application not send approval button to admin email. what is missing ?
We're a place where coders share, stay up-to-date and grow their careers.
Argument 1 passed to App\Notifications\NewUser::__construct() must be an instance of App\Notifications\User, instance of App\User given, called in /var/www/html/adminApprove/app/Http/Controllers/Auth/RegisterController.php on line 76
that error?
hi. I am new in Laravel. Have you figured out about this error?
People... you just need to add "use App\User;" after the namespace at the top of your file.
help me
Call to undefined method App\Notifications\NewUser::via()
this is my Controllerregister.php
...
use App\Notifications\NewUser;
...
$user = User::create([
'name' => $data['name'],
'prenom' => $data['prenom'],
'matricule' => $data['matricule'],
'fonction' => $data['fonction'],
'emploi' => $data['emploi'],
// recup id
//'id_role'=> $data['role'],
'id_str'=> $id_str,
'id_direct'=> $id_direct,
'id_ser'=> $id_ser,
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
$admin = User::where('email', 'dogosidik@gmail.com')->first();
if ($admin) {
$admin->notify(new NewUser($user));
}
return $user;
NewUser.php
class NewUser extends Notification
{
use Queueable;
}
ERROR::::
Argument 1 passed to App\Notifications\NewUser::__construct() must be an instance of App\Notifications\User, instance of App\User given, called in C:\xampp\htdocs\staffPortal\app\Http\Controllers\Auth\RegisterController.php on line 75
Help please
Hi, help please, am i missing something here ?
may i help you?
I get
Call to undefined method App\Notifications\NewUser::via()
I am using Laravel 5.8
Not any error not work this
in admin page not showing user that need to approve, and after register notification application not send approval button to admin email. what is missing ?
in admin page not showing user that need to approve, and after register notification application not send approval button to admin email. what is missing ?