mardi 20 mars 2018

Laravel conditional binding at runtime

I have a case where I have two different email providers for transactional emails (because one is unreliable). To know which provider I am using, I have a DB flag which controls which provider is to be used. I would also like to code to an interface so that I don't have to repeat too much code.

Is it possible in Laravel to use a Service Provider to check the provider setting in the DB before returning the binding for the emailing interface? If not, is it possible to bind an interface to an implementation in the controller?

Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DGV3Uz
via IFTTT

Aucun commentaire:

Enregistrer un commentaire