bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`
MIT License
1.35k stars 166 forks source link

Error when creating/editing role #385

Closed alekmlynek closed 2 months ago

alekmlynek commented 2 months ago

Suddenly, I started seeing this error: trim(): Argument #1 ($string) must be of type string, Filament\Support\Enums\IconPosition given

It happens when editing a Shield role or creating a new one—something to do with tabs. As it is fresh, I've not tried replacing this issue in another project yet. I am, however, frantically trying to figure out what went wrong.

Using the latest filament and shield. Tried downgrading, nothing is working.

Routing
Controller: BezhanSalleh\FilamentShield\Resources\RoleResource\Pages\EditRole@__invoke

Route name: filament.admin.resources.roles.edit

Middleware: panel:admin
<{{ $tag }}

    @if ($tag === 'button')

        type="{{ $type }}"

    @elseif ($tag === 'a')

        {{ \Filament\Support\generate_href_html($href, $target === '_blank', $spaMode) }}

    @endif

    @if ($hasAlpineActiveClasses)

        x-bind:class="{

            @js($inactiveItemClasses): ! {{ $alpineActive }},

            @js($activeItemClasses): {{ $alpineActive }},

        }"

    @endif

    {{     <<<<< This is what it is highlighting as the error (line 56), so something within this block

        $attributes

            ->merge([

                'aria-selected' => $active,

                'role' => 'tab',

            ])

            ->class([

                'fi-tabs-item group flex items-center gap-x-2 rounded-lg px-3 py-2 text-sm font-medium outline-none transition duration-75',

                $inactiveItemClasses => (! $hasAlpineActiveClasses) && (! $active),

                $activeItemClasses => (! $hasAlpineActiveClasses) && $active,

            ])

    }}

>
alekmlynek commented 2 months ago

Ok, I fixed it by removing my published filament components. Leaving this up incase anyone runs into this issue.

Delete: resources > views > vendors > filament

or publish your filament resources again