How to swap out dependency in laravel container
问题 I have registered a Paypal service provider: App\Providers\PaypalHelperServiceProvider::class, and, when I type hint it in my controller it properly resolves: public function refund(Request $request, PaypalHelper $paypal) {... Here is my provider class: class PaypalHelperServiceProvider extends ServiceProvider { protected $defer = true; public function register() { $this->app->bind('App\Helpers\PaypalHelper', function() { $test = 'test'; return new PaypalHelper(); }); } public function