How to create & register a service provider in laravel 5?
1. How to Create a Service Provider
php artisan make:provider CustomPostServiceProvider
After this command, a CustomPostServiceProvider.php
file under the app/Providers
directory will create with two methods like a boot()
and register()
.
2. How to register a Service Provider
To register our service provider, we need to add an entry in providers array in the config/app.php
file.
BY Best Interview Question ON 07 Apr 2019