1
0
Fork 0
Laravel Owl Admin Starter
 
 
 
 
Go to file Use this template
panliang 0e05b0c6bf update slowlyo/owl-admin:4.2.0 2025-05-07 11:59:18 +08:00
app 12 2025-03-14 17:48:34 +08:00
bootstrap api keyword 2024-07-09 13:26:31 +08:00
config update slowlyo/owl-admin v3.9.7 2024-09-16 16:51:51 +08:00
database admin users 2024-08-25 12:05:12 +08:00
lang UserService 添加表单验证 2024-10-31 11:29:57 +08:00
public update slowlyo/owl-admin:4.2.0 2025-05-07 11:59:18 +08:00
resources init 2024-07-07 14:33:24 +08:00
routes test oss 2024-09-18 11:08:20 +08:00
storage init 2024-07-07 14:33:24 +08:00
tests UserService 添加表单验证 2024-10-31 11:29:57 +08:00
.editorconfig init 2024-07-07 14:33:24 +08:00
.env.example update slowlyo/owl-admin:4.0.5 2024-11-07 12:43:48 +08:00
.gitattributes init 2024-07-07 14:33:24 +08:00
.gitignore init 2024-07-07 14:33:24 +08:00
README.md update slowlyo/owl-admin:4.0.5 2024-11-07 12:43:48 +08:00
artisan init 2024-07-07 14:33:24 +08:00
composer.json update slowlyo/owl-admin:4.0 2024-09-25 14:42:23 +08:00
composer.lock update slowlyo/owl-admin:4.2.0 2025-05-07 11:59:18 +08:00
package.json init 2024-07-07 14:33:24 +08:00
phpunit.xml init 2024-07-07 14:33:24 +08:00
vite.config.js init 2024-07-07 14:33:24 +08:00

README.md

Owl-Admin-Starter

  • PHP >= 8.2
  • laravel/framework: ^11.x
  • slowlyo/owl-admin: ^3.8

Helpers

上传文件

修改文件上传接口 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
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)) {
        $this->amisSchema['visible'] = admin_user()->can($this->amisSchema[$permissionKey]);
    }

    return \Slowlyo\OwlAdmin\Support\Cores\AdminPipeline::handle(static::class, $this->amisSchema);
}

重写 AdminService 中的 storeupdate 方法

  • app\Services\UserService.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, 组件文档