How to identify route in Laravel?

2

I'm using a template for the menu and footer to be duplicated on all pages. I put if in the footer for when it is a certain route he change the content, but that is not what is happening, he is interpreting each and every route as "home". If I access the "company" route it will go to the right page, but the footer will remain the same. Giving a echo Route::currentRouteName(); just got "home".

Routes

Route::get('/', array('as' => 'home', 'uses' => 'HomeController@index'));
Route::get('home', array('as' => 'home', 'uses' => 'HomeController@index'));
Route::get('empresa', array('as' => 'empresa', 'uses' => 'EmpresaController@index'));

Template

@if(str_is('home', Route::currentRouteName()))
    <div class="pure-g">
        <div class="pure-u-1">
            <footer id="rodapeHome">
                <p id="responsabilidadeSocialHomeRodapeTexto">Responsabilidade social também é nosso foco:</p>
                <div id="empresasResponsabilidadeSocial">
                    @foreach($acaoSocial as $acaoSocial)
                        <img src="assets/images/acaosocial/{{$acaoSocial->imagem}}" />
                    @endforeach
                </div>
            </footer>       
        </div>
        <div class="pure-u-1" id="caixaDireitosAutorais">
            <p id="tituloRodapeDireitosReservados">‎© 2014 Titina Leão - Todos os direitos reservados.<p/>
        </div>
    </div>
    
asked by anonymous 02.09.2014 / 18:53

1 answer

3

Before

Route::get('empresa', array('as' => 'home', 'uses' => 'EmpresaController@index'));

Then

Route::get('empresa', array('as' => 'empresa', 'uses' => 'EmpresaController@index'));

I have not changed the as , which is the name of the route. Ctrl + C and Ctrl + V more inattention = dead seals babies.

    
02.09.2014 / 18:56