pxlrbt / filament-spotlight

Quickly navigate your Filament pages
MIT License
239 stars 31 forks source link

Fix: return value must be of type string, null returned #32

Closed sakanjo closed 1 year ago

sakanjo commented 1 year ago

Fixes a problem when adding

'profile' => MenuItem::make()
    ->url(fn (): string => ViewProfile::getUrl()),

which will return null and cause Return value must be of type string, null returned error to occur.

pxlrbt commented 1 year ago

Is profile a new default menu item or why doesn't it require a label? Should this be added as a match case?

sakanjo commented 1 year ago

It doesn't require a label, filament checks if it's null then pass it the name of the user.

pxlrbt commented 1 year ago

Alright. Then this should be added to the match cases with the user name as the fallback like the other default pages/routes.

sakanjo commented 1 year ago

@pxlrbt the question mark should do the job, btw thanks for the great plugin!

pxlrbt commented 1 year ago

It fixes the error but doesn't solve the issue that the profile page won't appear on spotlight, right?

sakanjo commented 1 year ago

It doesn't, in that case you can check user-menu.blade.php.