Bootstrap with service providers:
Create Provider
php artisan make:provider PaymentServiceProviderRegister Method
public function register()
{
$this->app->singleton(PaymentGateway::class, function ($app) {
return new StripeGateway(config('services.stripe.key'));
});
}Boot Method
public function boot()
{
View::composer('*', function ($view) {
$view->with('settings', Settings::all());
});
}Register in Config
'providers' => [
App\Providers\PaymentServiceProvider::class,
],