mardi 5 avril 2016

Laravel 5 Blade Custom Directive - trouble passing variable

I am trying to create a Blade directive that will set a class on my table row depending on what gets passed in. The problem is that when I call it, the value of the variable is not being passed in - the literal string that I have between the parenthesis is.

In my view:

@row($inspection->inspection_disposition)

In the directive:

 Blade::directive('row', function($data)
    {
        var_dump($data);
           .
           .
           .
     }

What I see in the dump is:

string(37) "($inspection->inspection_disposition)"

Shouldn't I see the value of that variable? That's what I want. What am I missing here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire