File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ public function authorize(): bool
1010 {
1111 $ roleClass = config ("genealabs-laravel-governor.models.role " );
1212
13+ if (is_string ($ this ->role )) {
14+ $ this ->role = (new $ roleClass )
15+ ->where ("name " , $ this ->role )
16+ ->first ();
17+ }
18+
1319 return auth ()->check ()
1420 && ($ this ->role
1521 ? auth ()->user ()->can ("update " , $ this ->role )
@@ -27,6 +33,14 @@ public function rules(): array
2733
2834 public function process (): void
2935 {
36+ $ roleClass = config ("genealabs-laravel-governor.models.role " );
37+
38+ if (is_string ($ this ->role )) {
39+ $ this ->role = (new $ roleClass )
40+ ->where ("name " , $ this ->role )
41+ ->first ();
42+ }
43+
3044 $ permissionClass = config ("genealabs-laravel-governor.models.permission " );
3145 $ this ->role ->fill ($ this ->all ());
3246
You can’t perform that action at this time.
0 commit comments