mercredi 4 mai 2016

Custom Blade directive which should accept an array of objects ( in Laravel 5.2)

I'm new to the world of Laravel and I want to ask a question.

I want to make my own Blade Directive, which receives as a parameter an array of objects.

public function boot()
{
    Blade::directive('categories', function ($categories) {
        return $this->buildCategories($categories);
    });
}

I understand that this can not happen, because I receive a string. Then I saw this

 $isPublic = app('context')->isPublic() ? 'true' : 'false';

I accepted that app('context') returns context from controller. But I do not think it is. I even get Class context does not exist.

Is there any way the directive to take the content that was sent to the template or somehow get this array of objects ?



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

Aucun commentaire:

Enregistrer un commentaire