Artisans! I have a question.
In a package I'm creating the current way for using the class is by first using the Quickpay::api() method, and then tacking on any other method.
How could I change my code to skip this Quickpay::api()->payments()->create() and just go directly to Quickpay::payments()->create();
github.com/mortenebak/laravel-quickpay
Any help appriciated :)
Back
•
Use the service container with a binding (or singleton) in your ServiceProvider to inject a QuickPay instance instead of wiring it up in the constructor. This should allow to to skip the static constructor / api() method call.
•
Hmm I wouldn’t recommend. There is already a facade so why not use that if you like the static syntax but leave it as it is, so it’s possible to access the methods in the default way when using dependency injection.
•
In response to @lpheller
Ahh I didn't see the Facade. Then you're right, no need of doing that.