1
0
Fork 0
master
panliang 2023-10-10 22:59:37 +08:00
parent 9a070e84d6
commit 61cfba421a
1 changed files with 11 additions and 8 deletions

View File

@ -7,6 +7,7 @@ use App\Models\Keyword;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Slowlyo\OwlAdmin\Models\AdminPermission;
use Slowlyo\OwlAdmin\Services\AdminPermissionService;
/**
* @method Keyword getModel()
@ -91,13 +92,15 @@ class KeywordService extends BaseService
public function afterCreate($model)
{
// 创建对应的权限
AdminPermission::updateOrCreate([
'slug' => $model->key,
], [
'name' => $model->name,
'parent_id' => 0,
'order' => 1
]);
if ($model->type_key == 'treat_type') {
// 创建对应的权限
(new AdminPermissionService())->store([
'slug' => $model->key,
'name' => $model->name,
'parent_id' => 0,
'order' => 1
]);
}
}
}