0

I am new to Laravel, in Laravel 5.8 I am trying to personalize the message in verification email to be:

Hello $username;
Congrats now you are registered at our website
Please confirm this email is yours
.... 

what I want if you may kindly to tell me how to do this? also I want the default verification url of the button that is in verification email to stay as it is. in other words I want just to edit the text that is sent, how to do this?

mark820850
  • 123
  • 1
  • 11
  • 1
    Possible duplicate of [Laravel Email Verification Template Location](https://stackoverflow.com/questions/52231870/laravel-email-verification-template-location) – nakov Aug 15 '19 at 16:21

2 Answers2

0

Refer documentation

Laravel will generate all of the necessary email verification views when the make:auth command is executed. This view is placed in resources/views/auth/verify.blade.php. You are free to customize this view as needed for your application.

Prafulla Kumar Sahu
  • 9,321
  • 11
  • 68
  • 105
-1

To make sure that the user is the owner of the email you need to do the following steps: first see https://laravel.com/docs/5.8/mail to download the configurations and create mail class:and write

   public function __construct(User $user)
   {
    $this->user = $user;
   }

Second you have to create a view that will be sent to the user after that you have to passe information you wanted in

 public function build()
{
    return $this->view('emails.orders.shipped')
                ->with([
                    'username' => $this->user->name,
                    'usertoken' => $this->user->token
                ]);
}

in your view file you may use this variable for user token is just random string related to that user so your view file it look something like this

<p>hello {{username}}</p>
<a href="{{route('verify',"token"=>usertoken)}}">click to confirm</a>

and in your web.php file

Rout::get('user/verify/{{token}}/','controller@verify')->name('verify');

in your controller do

public function verify(request, $token){
$user=App\User::where('user-token', $token');
if(!$user->verify){
   $user->update(['verify' => true],['token'=>""]);

   return view('succes page');
   }else{
    return 'error message'
    }

so, what we did here in migrations file we define each user as verifyed or not and we give them a nullable token that defined them so when the user want to authenticat we send them the token to their email and we delete it so there is no future collision you send email like this:

 Mail::to($request->user()->email)->send(new yourmailclass($user));

I hope this will help you,there is no mistake in the code and this is what you wanted:have a nice day :)

ali filali
  • 310
  • 4
  • 8