准备:密码重置功能如果无法使用laravel自带的,就可以用sendcloud代替
原创
2022-09-09 10:13:01
317阅读
1、控制器中使用$posts = Post::orderBy('created_at','desc')->paginate(5);2、模板中显示页码按钮{{$posts->links()}}
原创
2022-09-09 10:14:40
78阅读
Policy(即策略)是在特定模型或者资源中组织授权逻辑的类,用来处理用户授权动作。比如在博客
原创
2022-09-09 10:14:58
1237阅读
SendCloud官网https://www.sendcloud.net/准备:SendCloud官网注册账号,每天有免费发
原创
2022-09-09 10:13:11
120阅读
1、使用load$posts = Post::all();$posts->load('user');2、使用with$posts = Post::with('user')->all();
原创
2022-09-09 10:14:15
122阅读
分析:实际开发中,个人用户资料往往需要不断增加,比如昵称、邮箱、年龄。后期随着业务的增加可能会需要增加身高、体重、城市等信息,如果采用一个资料对应一个字段的方法,后期维护和可用性都会大大下降,因此可以采用类似json的方式存储资料,比如{"name":"tom","age","18"}一个字段便可存储多个资料,且拓展性可用性都比较高。1、数据库设计Schema::create('us...
原创
2022-09-09 10:16:20
81阅读
实际开发时,我们需要多个视图共享同一个数据,通常由下列三种方法1、每个页面使用该数
原创
2022-09-09 10:14:03
65阅读
说明:实际开发时,如果控制器中写的代码太多会影响可读性,因此可以将控制器中的代码放入到
原创
2022-09-09 10:12:54
163阅读
1、路由Route::get('/password','PasswordController@password');Route::post('/password/update','PasswordController@update');2、view <form class="form-horizontal" role="form" method="POST" action...
原创
2022-09-09 10:16:41
427阅读
1、创建app\Support\helpers.phpif (!function_exists('user')){ function user($driver = null){ if($driver){ return app('auth')->guard($driver)->user(); } re...
原创
2022-09-09 10:16:52
144阅读
1、安装composer require "overtrue/laravel-ueditor:~1.0"2、注册Overtrue\LaravelUEditor\UEditorS
原创
2022-09-09 10:13:07
557阅读
sts\Flash\FlashServiceProvider::class,3、控制器中public function login()...
原创
2022-09-09 10:13:36
128阅读
1、AuthServiceProvider.phppublic function boot() { // $this->registerPolicies(); $permissions =
原创
2022-09-09 10:14:09
120阅读
分析:评论--问题 评论--答案使用morphTo、morphMany1、定义模型关系question.phppublic function
原创
2022-09-09 10:11:19
131阅读
1、package.json{ "private": true, "scripts": { "prod": "gulp --production", "dev": "gulp
原创
2022-09-09 10:12:16
121阅读
思路分析:我的粉丝 一对多 hasMany我关注的人 一对多 hasMany1、在model User.php中返回
原创
2022-09-09 10:14:27
74阅读
步骤1、使用自带的users migration,增加几个字段publ...
原创
2022-09-09 10:13:23
33阅读
1、AppServiceProvider.php中\DB::listen(function ($query){ $sql = $query->sql; $bindi
原创
2022-09-09 10:14:37
61阅读
分析:评论--文章 多对一 belong文章--评论 一对多 hasMany文章--用户 多对一 belong评p;use Illuminate\Databas...
原创
2022-09-09 10:14:45
102阅读
1、控制器中public function add(){ //validate 验证 $rules = [ 'title'=>'required|stri
原创
2022-09-09 10:14:50
1108阅读