# Owl-Admin-Starter - PHP >= 8.2 - laravel/framework: ^11.x - slowlyo/owl-admin: ^3.8 ## 修改内容 ### 上传文件 修改文件上传接口 `admin-api/upload_file`, `admin-api/upload_image`, 返回完整链接 - `app\Admin\Controllers\HomeController.php@upload` ### SQL 日志 监听sql执行, 打印日志 - `app/Providers/QueryLogServiceProvider.php` - `bootstrap/providers.php` ### 无限级分类 - `app/Traits/TreePath.php` | column | name | comment | | - | - | - | | parent_id | 上级id | 默认: 0 | | path | 所有上级id | 默认: -, 例如: -1-2-3- | | sort | 排序 | 正序 | ### 修改 `BaseRenderer` 中的 `permission` 方法 - `vendor\slowlyo\owl-admin\src\Renderers\BaseRenderer.php` ```php public function filteredResults() { $permissionKey = 'owl_permission'; // if (key_exists($permissionKey, $this->amisSchema)) { // if (!admin_user()->can($this->amisSchema[$permissionKey])) { // return data_get($this->amisSchema, 'owl_permission_replace_value', ''); // } // } if (key_exists($permissionKey, $this->amisSchema) && Admin::config('admin.auth.permission')) { $this->amisSchema['visible'] = admin_user()->can($this->amisSchema[$permissionKey]); } return \Slowlyo\OwlAdmin\Support\Cores\AdminPipeline::handle(static::class, $this->amisSchema); } ``` ### 重写 `AdminService` 中的 `store` 和 `update` 方法 - `app\Services\UserService.php` ```php public function store($data) { $this->saving($data); $model = $this->modelName::create($data); $this->saved($model); return true; } public function update($primaryKey, $data) { $this->saving($data, $primaryKey); $model = $this->query()->whereKey($primaryKey)->first(); $model->update($data); $this->saved($model, true); return true; } ``` ## TODO - 表单验证: 服务端返回 `errors` 错误信息, 未在输入框上显示, 示例文件: `app\Services\UserService.php`, [组件文档](https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%A0%A1%E9%AA%8C) - CURD 组件: 如果存在 `bulkActions` 按钮时, 表格会出现滚动条