Problem with links in laravel

1

I have developed an application in laravel 5.5 and I have added a template that I have purchased. I have the problem in the main layout, which is where I have the top, horizontal and vertical menu bars and, in some views, I do not respect hyperlinks. For example:

I have this button:

Which is the dropdown menu of user administration and settings, dropdown menu, I put the code of the parent layout that extends this view:

<div class="dropdown-menu dropdown-menu-right">
    <a href="{{ url('/worker/show/.Crypt::encrypt(Auth::user()->id)') }}" class="dropdown-item">
    <i class="icon-head"></i> Editar Perfil</a>
    <a href="{{ route('logout') }}" class="dropdown-item" onclick="event.preventDefault();document.getElementById('logout-form').submit();">Logout</a>
    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
        {{ csrf_field() }}
    </form>
</div>

If I inspect the code I see that this link that says "worker/show... does not work, here is the inspection code:

<a href="" data-toggle="dropdown" class="dropdown-toggle nav-link dropdown-user-link" aria-expanded="false">
    <span class="avatar avatar-online">
        <img src="/images/portrait/small/avatar-s-1.png" alt="avatar"><i></i>
    </span>
    <span class="user-name">Admin</span>
</a>

The dropdown does not unfold, but it only happens in some views. What is this about? Am I not extending the views well? All views extend from the parent layout and have well-defined sections. I can put the code of the views if you need it.

Thanks for the attention. A greeting.

Edit:  Routes:

Route::get('/worker/show/{id_worker}', 'UserController@show');
//rutas accessibles solo para el usuario administrador
Route::group(['middleware' => 'usuarioAdmin'], function () {
    Route::get('/home', 'HomeController@index')->name('home');
    //Rutas empleados
});
//rutas accessibles solo para el usuario standard
Route::group(['middleware' => 'usuarioStandard'], function () {
    Route::get('/vacation/create', 'VacationController@index');
    Route::get('/vacation/creat/{id_worker}/{name_worker}', 'VacationController@create');

});
    
asked by Peisou 27.08.2018 в 16:00
source

2 answers

2

The real answer to this problem, apart from what Shassain indicated, which is correct, was that it was including bootstrap and jQuery twice and there was a confusion with hyperlinks that was causing. The link was always printed, only it was hidden.

It is advisable to use the route() method instead of url() since the url() method only helps you create the string after your domain, the method will not verify that the registered route exists, it will print whatever you put inside it, nor does it print null.

    
answered by 27.08.2018 / 17:25
source
1

Apparently you only have one syntax error, in:

<a href="{{ url('/worker/show/.Crypt::encrypt(Auth::user()->id)') }}" class="dropdown-item">

With an error in the point (.) between show/.Crypt ... and what follows, point by which the route is not found and is not displayed in html.

The correct format would be:

<a href="{{ url('/worker/show/'.Crypt::encrypt(Auth::user()->id)) }}" class="dropdown-item">
    
answered by 27.08.2018 в 16:37