更新时间:2023-11-17 18:21:58
首先,您应哈希并创建用户"详细信息以使该列准备好进行身份验证.
First you should hash and create the User details to make the coloumn ready for authentication.
在这里,我已经给出了实现它的步骤.
Here i have given the steps to achieve it.
步骤1:获取输入
$UserData = Input::all();
第2步::创建条目-插入用户表
Step 2 : Create the entry - Inserting into User Table
User::create($UserData);
注意:
您应该在users
表中包含以下几句
You should have these following coloumns in your users
table
其他设置:
在您的User.php(模型)中有此行
Have this line in your User.php (Model)
protected $fillable = ['email', 'password'];
这是我的小登录代码,对您来说足够简单
如有需要,请尝试一下
$email = $this->request->input('email');
$password = $this->request->input('password');
if (Auth::attempt(['email' => $email, 'password' => $password])) #If the Credentials are Right
{
return redirect::intended('student/index'); #Your Success Page
}
else
{
return redirect('student/admin'); #Your Failure Page
}
推荐:
我还建议在创建之前先验证用户输入
I would also recommend to validate the user input before creating
附加说明:
如果您看到表格,并且密码像加密的一样,则表示您已经完成;)
If you see your table and if you password is something like encrypted and it means that you're done ;)