I'm trying to send a validation email to a registering customers email address, but It is giving me the error in question rather than sending the notification email.
Create user :
$validator = Validator::make($request->all(), [
'name' => ['required', 'alpha_dash', 'string', 'max:25', 'unique:customers'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:customers'],
'password' => ['required', 'string', 'min:6', 'confirmed'],
]);
if ( $validator->fails() ) {
$messages = $validator->messages();
return Redirect::back()->withErrors($validator)->withInput();
foreach($errors->all() as $error) {
echo $error;
}
} elseif ( $validator->passes() ) {
$customer = customer::create([
'name' => $request['name'],
'email' => $request['email'],
'password' => Hash::make($request['password']),
'VerifyToken' => Str::random(40),
]);
$customer->SendEmailVerificationNotification();
return redirect()->intended('login/customer');
}
SendEmailVerificationNotifaction:
public function toMail($notifiable)
{
$verificationUrl = $this->verificationUrl($notifiable);
if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $verificationUrl);
}
Mail::to($notifiable->email)->send(new validate_email($notifiable->email));
}
Any help would be fantastic! Struggling here Thankyou :)