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 :)