It doesn't matter where you place your provider class. As long as it extents Illuminate\Support\ServiceProvider and is defined in the config/app.php Laravel will treat it as a provider. The reason we define a provider and register everything there is because we don't have to write a lot.
For example its easier to use $this->app->singleton to register a class rather than defining the singleton construct in the class itself. You can also register any events, configuration, migrations, etc on the service provider class saving a lot of unnecessary coding.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community