phplaravellaravel-facadelaravel-filament

Laravel Filament library magic


I know Laravel uses Facades and Containers that overload class methods, but when I read the documentation of Filament I see a method called the Filament facade, and this method is named "serving". So I decided to make a search with VS Code in all the files on the project to find the keyword "serving" and I'm not excluding the "vendor" folder, but the only thing I can find is the DispatchServingFilamentEvent class. I never find an occurrence of the "serving" keyword anywhere. There is no Trait containing this method in the Filament vendor directory nor using a function from anywhere. It's just curiosity but I can't figure how it is possible. Can anyone explain this sorcery to me please?

It looks like this : Filament::serving()

https://filamentphp.com/docs/2.x/admin/appearance#changing-the-brand-logo


Solution

  • That's a static facade method, it calls this method on the FilamentManager class:

    https://github.com/filamentphp/filament/blob/2.x/packages/admin/src/FilamentManager.php#L163-L166