vendredi 1 janvier 2016

Laravel 5.1 defer service provider until another is loaded

I'm using the FormBuilder in Laravel 5.1. The HtmlServiceProvider states the Html and Form facades should defer loading until they are actually needed, which is fine.

However, I have created a FormServiceProvider which registers several macros that I will use in my views. This provider doesn't run any bindings, it simply records a few macros within the FormBuilder class.

However, by storing these macros using the boot method on my own service provider, it's loading the Form binding instantly (making the deferred loading pointless).

Question

Is there any way to defer the boot method in one service provider until another service provider has binded facades?

OR, is there a way to listen for specific binding (or aliasing) events, then manually run a service provider?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire