lundi 23 septembre 2019

Push Blade snippets to the stack from one Laravel package to another 'parent' package

I've create a private core CMS package and am in the process of creating sub packages for adding additional functionality as required.

So in the core CMS package I have a view with:

<ul class="nav">
   @stack('navigation')
</ul>

And another view with core nav items:

@push('navigation')

    <li class="nav-item">
        <a class="nav-link" href=""><i class="fa fa-book"></i>
            Pages</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" href=""><i class="fa fa-newspaper"></i>
            News</a>
    </li>

@endpush

So what I'd like to do (if it's possible) is add to the @stack from another package. E.g:

@push('navigation')
    <li class="nav-item">
        <a class="nav-link" href=""><i class="fa fa-calendar-day"></i>
            Events</a>
    </li>
@endpush

This isn't working as kind of expected. Is there a way to do this? I've considered adding all the nav items to a database table and then adding seeds to the package and an install command but I thought this would be a more elegant way.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire