I try to create a custom Blade directive as documented in to official docs.
I created a custom package and installed it via composer. The boot function inside my serviceprovider registers the directive:
public function boot()
{
Blade::directive('react', function($expression) {
return "Test";
});
}
The class is loaded and the boot-function executed. When adding debug output to BladeCompiler@directive my directive is added to the customDirectives array.
But the array inside BladeCompiler@compileStatements is empty so my directive is never executed.
By using spl_object_hash() I found out that $this inside those two functions returned different hashes.
What am I doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire