You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When trying to create a new role in Filament the error is shown:
BezhanSalleh\FilamentShield\FilamentShield::getDefaultPermissionIdentifier(): Return value must be of type string, Illuminate\Support\Stringable returned
BezhanSalleh\FilamentShield\FilamentShield::getLocalizedResourcePermissionLabel(): Return value must be of type string, Illuminate\Support\Stringable returned
Note
🚨 Before creating a new issue, please make sure to:
1️⃣ Search closed issues to check if your question or issue has already been addressed.
2️⃣ Read the documentation to see if your question is answered there.
3️⃣ **If steps and requirements outlined aren't fulfilled the issue will be deleted.
The docs often cover common questions and problems.
If your issue is new and not covered elsewhere, please provide all relevant details below:
Expected behavior
Page that allows creating a new role.
please complete the following information:
OS: Linux/Docker
Filament 3.2.130
Version 3.3.4
Additional context
The problem seems to be in the getLocalizedResourcePermissionLabel and getDefaultPermissionIdentifier functions that expect string as a return type but Illuminate\Support\Stringable is returned. If I cast the return as a string e.g.:
return (string) Str::of($resource)
->afterLast('Resources\')
->before('Resource')
->replace('\', '')
->snake()
->replace('_', '::');
and
return (string) (Lang::has("filament-shield::filament-shield.resource_permission_prefixes_labels.{$permission}", app()->getLocale())
? __("filament-shield::filament-shield.resource_permission_prefixes_labels.{$permission}")
: Str::of($permission)->headline());
Same error is triggered with artisan shield:generate in the CanGeneratePolicy command. The return should be string but it's Illuminate\Support\Stringable. Casting to string makes it work.
are you by any chance using the configurePermissionIdentifierUsing() or altering anything else? because i have 16 apps in prod and i haven't been able to reproduce what you are describing. submit a repro repo and i will take a look at it.
Describe the bug
When trying to create a new role in Filament the error is shown:
BezhanSalleh\FilamentShield\FilamentShield::getDefaultPermissionIdentifier(): Return value must be of type string, Illuminate\Support\Stringable returned
BezhanSalleh\FilamentShield\FilamentShield::getLocalizedResourcePermissionLabel(): Return value must be of type string, Illuminate\Support\Stringable returned
Note
🚨 Before creating a new issue, please make sure to:
1️⃣ Search closed issues to check if your question or issue has already been addressed.
2️⃣ Read the documentation to see if your question is answered there.
3️⃣ **If steps and requirements outlined aren't fulfilled the issue will be deleted.
The docs often cover common questions and problems.
If your issue is new and not covered elsewhere, please provide all relevant details below:
Expected behavior
Page that allows creating a new role.
please complete the following information:
Additional context
The problem seems to be in the getLocalizedResourcePermissionLabel and getDefaultPermissionIdentifier functions that expect string as a return type but Illuminate\Support\Stringable is returned. If I cast the return as a string e.g.:
return (string) Str::of($resource)
->afterLast('Resources\')
->before('Resource')
->replace('\', '')
->snake()
->replace('_', '::');
and
return (string) (Lang::has("filament-shield::filament-shield.resource_permission_prefixes_labels.{$permission}", app()->getLocale())
? __("filament-shield::filament-shield.resource_permission_prefixes_labels.{$permission}")
: Str::of($permission)->headline());
(or use: Str::of($permission)->headline()->toString() )
It works. Using Laravel 11.35.1
The text was updated successfully, but these errors were encountered: