File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,10 @@ public static function create(array $attributes = [])
5151
5252 // Check for case-insensitive duplicate
5353 $ existing = static ::where ('guard_name ' , $ attributes ['guard_name ' ])
54- ->whereRaw ('LOWER(name) = LOWER(?) ' , [$ attributes ['name ' ]])
55- ->first ();
54+ ->get ()
55+ ->first (function ($ item ) use ($ attributes ) {
56+ return strtolower ($ item ->name ) === strtolower ($ attributes ['name ' ]);
57+ });
5658
5759 if ($ existing ) {
5860 throw PermissionAlreadyExists::create ($ attributes ['name ' ], $ attributes ['guard_name ' ]);
Original file line number Diff line number Diff line change @@ -63,8 +63,7 @@ public static function create(array $attributes = [])
6363 }
6464
6565 // Check for case-insensitive duplicate
66- $ query = static ::where ('guard_name ' , $ attributes ['guard_name ' ])
67- ->whereRaw ('LOWER(name) = LOWER(?) ' , [$ attributes ['name ' ]]);
66+ $ query = static ::where ('guard_name ' , $ attributes ['guard_name ' ]);
6867
6968 if ($ registrar ->teams ) {
7069 $ teamsKey = $ registrar ->teamsKey ;
@@ -74,7 +73,9 @@ public static function create(array $attributes = [])
7473 });
7574 }
7675
77- $ existing = $ query ->first ();
76+ $ existing = $ query ->get ()->first (function ($ item ) use ($ attributes ) {
77+ return strtolower ($ item ->name ) === strtolower ($ attributes ['name ' ]);
78+ });
7879
7980 if ($ existing ) {
8081 throw RoleAlreadyExists::create ($ attributes ['name ' ], $ attributes ['guard_name ' ]);
You can’t perform that action at this time.
0 commit comments