1.1需要学习知识点消息通知系统
- 过程解析:
- 流程示例
1.点击找回密码
2.输入要找回的qq号,然后等待qq邮件:
3.点击邮件内容传送
4.最终修改密码
2.代码示例
使用到的路由
#修改密码
Route::get('FindPasswordEmail','PasswordController@email')->name('FindPasswordEmail');
Route::post('FindPasswordSend','PasswordController@send')->name('FindPasswordSend');
Route::get('FindPasswordEdit/{token}','PasswordController@edit')->name('FindPasswordEdit');
Route::post('FindPasswordUpdate','PasswordController@update')->name('FindPasswordUpdate');
2.1.找回密码模板,
@extends('layouts.default')
@section('content')
<form action="{{route('FindPasswordSend')}}" method="post">
{{csrf_field()}}
<div class="card">
<div class="card-header">
找回密码
</div>
<div class="card-body">
<div class="form-group">
<label for="">邮箱</label>
<input type="text" name="email" id="" class="form-control" >
<small id="helpId" class="text-muted">请输入注册时的邮箱</small>
</div>
</div>
<div class="card-footer text-muted">
<button class="btn btn-success">发送</button>
</div>
</div>
</form>
@endsection
2.2 发送邮件的代码
控制器代码
public function send(Request $request){
$user=User::where('email',$request->email)->first();
Notification::send($user,new FindPasswordNotify($user->email_token));
}
调用的代码
php artisan make:notification FindPasswordNotify
创建通知类
2.3 剩下的类: