bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

strrpos(): Argument #1 ($haystack) must be of type string, Filament\Widgets\WidgetConfiguration given for ::make() with config

eelco2k opened this issue · comments

Because some widgets use the ::make() with some parameters it would perhaps be better to always get the classname if type is not string. An example where occurs is in package Phpsa\FilamentAuthentication\Widgets

LatestUsersWidget::make(['limit' => 5, 'paginate' => true]),

in FilamentShield.php

return ! in_array(Str::afterLast($widget, '\\'), Utils::getExcludedWidgets());

perhaps do a check on instance type:

if($widget instanceof \Filament\Widgets\WidgetConfiguration) {
   return !in_array(Str::afterLast($widget->widget, '\\'), Utils::getExcludedWidgets());
}

related to: #226