首页 > 解决方案 > 使用 laravel 5.7 进行电子邮件验证

问题描述

所以我在 laravel 5.7 中遇到了这个问题,当一个新的测试求职者发出验证电子邮件被发送到 mailtrap 时,我试图构建一个验证电子邮件脚本。正常情况下,验证脚本应该从数据库中选择测试求职者 ID,但问题是 inmail 陷阱它没有正确显示的链接(错误的 ID)

http://127.0.0.1:8000/job_seeker.verification/ 1566934249 ?signature=a70c7846941347109945c2e9d07ccbcd285082e3b1f561d15e4b86d3afceb467

带有粗体文本的区域应该是正确的 id

https://github.com/moussa03/job_board

这是整个项目的链接,以防万一有人想看看它,任何帮助将不胜感激

我已经尝试过以下链接的解决方案 Apply Laravel 5.7 MustVerifyEmail on Multiple Authentication System

整个项目存在于 github

使用验证链接选择新用户 ID 时不会弹出错误消息

标签: phplaravel

解决方案


$company = new Company;
    if($request->input('website') != ""){
        $company->website = $request->input('website');
    }
    $company->name = $request->input('name');
    $company->type = $request->input('type');
    $company->city = $request->input('city');
    $company->phone = $request->input('phone');
    $company->varificationcode = sha1(time());
    $company->profile_description = "No description";
    $company->user_id = $user->id;
    $company->save();

    Mail::to($request->input('email'))->send(new VarifyMail($company));

在电子邮件模板中,我访问了这样的公司数据:

  <h2 id="greet">Welcome {{$user->name}} to MyCompany</h2>
  <br/>
  <p class="lead">Thank you for registering to our website. It's an honor to have you in our community.</p>
  <br/>
  <p class="lead">Your account has been successfully created. in order to be able to login for the first time, click the link below to activate your account.</p>
  <br/>
  <a class="btn btn-sucess pl-5 pr-5" href="{{url('company/verify',[$user->id ,$user->varificationcode])}}">Verify Email</a>

推荐阅读