我创建了通过电子邮件发送的调查,基本上应用程序会根据用户的电子邮件记录用户数据,如果电子邮件不存在于路线中,则无法填写调查,但即时通讯不太确定,如果即时通讯正确的方式,也为了安全的目的,也许我应该有一些关于电子邮件的验证。有人能告诉我什么是最佳做法,或者我做的方式是否已经很好?!URL上的验证电子邮件地址
,该用户输入的URL是这样的:
http://domain.com/surveys/23/[email protected]/show
这里是我的代码:
路线:
Route::get('surveys/{id}/{email}/show/', '[email protected]');
控制器:
public function show($id,$email)
{
$survey = Survey::find($id);
$email = $email;
return view('admin.surveys.show', compact('survey','email'));
}
查看:
Html
...
@if(!empty($email))
show the survey form
@else
A message saying is not possibile fill without a email
@endif
注:本次调查完全是通讯系统的一部分,它们之间没有任何形式的整合。
使用验证器,用于验证输入字段.. – Sona
有没有输入字段... – Pedro