mardi 11 juillet 2017

how to include laravel @php code block in several views

i made a small package to resolve multilocal routes params, however atm i have a code block that i have to repeat across each view file

@php
    $route = SimpleMenu::getRoute($one->route_name, [
        'about'      => ['name'=>'hello'],
        'contact-us' => ['name'=>'other'],
    ]);
@endphp

but i was trying to find a way to avoid repeating it by adding the code to a separate file and simply include it wherever its needed through @include or @extend but sadly it doesnt work. :(.

so does anyone knows how to get around this issue ?



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

1 commentaire:

  1. If you'd like an alternative to randomly approaching girls and trying to figure out the right thing to say...

    If you'd prefer to have women chase YOU, instead of spending your nights prowling around in noisy bars and restaurants...

    Then I encourage you to view this short video to discover a strange little secret that might get you your personal harem of sexy women:

    FACEBOOK SEDUCTION SYSTEM!!!

    RépondreSupprimer