Skip to content

Commit 6687f0d

Browse files
committed
fix(control): 路由为 NULL 问题
1 parent 05c87c9 commit 6687f0d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

laravel/app/Http/Controllers/Api/PermissionController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function store(Store $request)
6161
$name = $request['name'];
6262
$permission = new Permission();
6363
$permission->name = $name;
64+
!is_null($request['route']) && $permission->route = $request['route'];
6465

6566
if ($permission->save()) {
6667
if (!empty($request['roles'])) { // 如果选择了角色
@@ -116,6 +117,7 @@ public function edit($id)
116117
public function update(Update $request, $id)
117118
{
118119
$input = $request->all();
120+
is_null($input['route']) && $input['route'] = '';
119121
// $model = new Category();$model->save($input, ['id' => $id]);
120122
// 老版本更新操作如下,新版本先查询再更新
121123
// Category::where('id', $id)->update($input)

0 commit comments

Comments
 (0)