当前位置:网站首页>laravel 8 实现Auth登录
laravel 8 实现Auth登录
2022-06-24 13:04:00 【s_罐装冰块】
注:在 使用auth登录时,必须要求密码在数据库进行加密,而且
auth登录必须使用username和password。加密密码可以使用函数 bcrypt() 进行加密。
1.后台控制器进行验证登录。
//接收传过来的值
$username = $request->post('username');
$password = $request->post('password');
$catch = $request->post('catch');
//通过验证器进行验证
$validatedData = $request->validate([
'username' => 'required',
'password' => 'required',
]);
//使用auth进行登录验证
$res = Auth::attempt($validatedData);
if ($res) {
//登录成功跳转到列表页面
return redirect('show');
} else {
echo "登录失败";
}2.对登录模型进行配置。

3.在我们的laravel配置文件里面进行一些配置修改。
引入我们刚刚设置过的模型。

最后进行登录测试
边栏推荐
- 打败 二叉树!
- 【比特熊故事汇】6月MVP英雄故事|技术实践碰撞境界思维
- [learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX
- A review of text contrastive learning
- 【Pytorch】量化
- ssh-keygen 配置无需每次输入密码
- 3环杀掉360安全卫士进程
- Halcon 绘制区域 到图片中
- R语言plotly可视化:可视化模型在整个数据空间的分类轮廓线(等高线)、meshgrid创建一个网格,其中每个点之间的距离由mesh_size变量表示、使用不同的形状标签表征、训练、测试及分类标签
- The difference between V-IF and v-show
猜你喜欢

Go语言三个高效编程的技巧

数字臧品系统开发 NFT数字臧品系统异常处理源码分享
![[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX](/img/d1/4b21c8049f0377b54a18a9b267432e.png)
[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX

文本对比学习综述

Daily knowledge popularization

Unit contour creation method

Win10 system problems

OpenHarmony 1

Rasa 3. X learning series - it is a great honor to be a source code contributor of Rasa contributors, and to build and share the rasa community with rasa source code contributors all over the world!

v-for 中 key的作用和原理
随机推荐
c语言---18 函数(自定义函数)
【Pytorch】量化
3环杀掉360安全卫士进程
融云通信“三板斧”,“砍”到了银行的心坎上
探索云原生数据库,纵观未来科技发展
Jerry has opened a variety of decoding formats, and the waiting time from card insertion to playback is long [chapter]
数商云:加强供应商管理,助推航空运输企业与供应商高效协同
业务与技术双向结合构建银行数据安全管理体系
Kunpeng arm server compilation and installation paddlepaddle
Mit-6.824-lab4a-2022 (ten thousand words explanation - code construction)
GO语言-init()函数-包初始化
常见的单例模式&简单工厂
百度地图API绘制点及提示信息
Win10 system problems
markdown/LaTeX中在字母下方输入圆点的方法
文本对比学习综述
15 differences between MES in process and discrete manufacturing enterprises (Part 2)
六月集训(第23天) —— 字典树
4 reasons for "safe left shift"
Jerry's serial port receiving IO needs to set the digital function [chapter]