查询作用域 全局作用域 全局作用域允许你对给定模型的所有查询添加约束。使用全局作用域功能可以为模型的所有操作增加约束。 软删除功能实际上就是利用了全局作用域功能 实现一个全局作用域功能只需要定义一个实现Illuminate\Database\Eloquent\Scope接口的类,该接口只有一个方法apply,在该方法中增加查询需要的约束
## WSL2&Ubuntu 安装 LNMP 开发环境 - 更新并升级 ``` sudo apt update sudo apt upgrade ``` - 安装 nginx ``` sudo apt install nginx ``` 验证 nginx 配置 `nginx -t` 报错: ``` nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) 2020/12/16 16:47:58 [warn] 19050#19050: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 2020/12/16 16:47:58 [emerg] 19050#19050: open() "/run/nginx.pid" failed (13: Permission denied) nginx: configuration file /etc/nginx/nginx.conf test failed ``` 原因是当前用户权限不足 `su root` 切换到 root 即可 `service nginx start` 启动服务
1:打开laradock/.env配置文件 WORKSPACE_INSTALL_WORKSPACE_SSH=true 将其改为true,然后重新build workspace 2:打开shell工具连接workspace
1:composer安装laravel-log-viewer 2:在config/app.php的providers添加服务 3:在路由器中添加路由 4:创建view文件 5:在config/logging.php新增一个自定义配置 6:测试
在实际开发中肯定遇到过项目用不同的laravel版本,服务器也是用不同的php版本 导致本地跑项目的时候会存在php版本不兼容的问题,想着能不能用laradock配置多版本php共存 在网上找了很久没有能直接拿到就用的,不过在其中却得到一些启发