Dependency Injection in Filament
I have been using laravel filament for a month now. It is quite good and most of my requirements are well served by it. But recently due to a requirement I am trying to inject one of my custom service class in a custom page class, but somehow I am not able to do so. In laravel, we inject the dependency via constructor or in controller action. I know I can use app() to resolve them. But what is the proper or best way to do it?
2 Replies
you can inject them as method parameter in most cases
but laravel style would also be creating a facade
@Ashraf I have the same requirement, But I couldn't resolve it via the
app()
. Could you please tell me how we can achieve it? Or did you find the best way to implement it?
I have resolved it via boot() method.