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