Skip to content

Commit 70e3291

Browse files
committed
fix(model): 运行填充字段和删除权限的方法
1 parent a41e4a5 commit 70e3291

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

laravel/app/Role.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
class Role extends Model
88
{
9+
10+
protected $fillable = ['name'];
11+
912
// 用户和角色的模型关联关系
1013
public function users()
1114
{
@@ -23,4 +26,10 @@ public function givePermissionTo($permission)
2326
{
2427
return $this->permissions()->save($permission);
2528
}
29+
30+
// 角色删除权限
31+
public function revokePermissionTo($permission)
32+
{
33+
return $this->permissions()->delete($permission);
34+
}
2635
}

0 commit comments

Comments
 (0)