Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Route [listadopresos] not defined IN laravel 8

I wanted to add a link to another page in a view, but I get the following error message
enter image description here

this is my web.php the route "listadopresos" doesn´t works

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\CustomAuthController;

Route::get('dashboard', [CustomAuthController::class, 'dashboard']); 
Route::get('listadopresos', [CustomAuthController::class, 'listado']);
Route::get('login', [CustomAuthController::class, 'index'])->name('login');
Route::post('custom-login', [CustomAuthController::class, 'customLogin'])->name('login.custom'); 
Route::get('registration', [CustomAuthController::class, 'registration'])->name('register-user');
Route::post('custom-registration', [CustomAuthController::class, 'customRegistration'])->name('register.custom'); 
Route::get('signout', [CustomAuthController::class, 'signOut'])->name('signout');

In de CustomAuthController i have this function to return de "listadopresos" view

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

    public function listado(){
       
            return view('listadopresos');

    }

and in dashboard.blade.php the file with the link i want to redirect to the listadopresos.blade.php

    <a  class="btn aviso" href="javascript:window.open('{{ route('listadopresos')}}','','width=600,height=600,left=50,top=50,toolbar=yes');void 0">Listado</a> 

I don’t know what I can do to fix it

>Solution :

in your routes add name for your route

for example like this

Route::get('listadopresos', [CustomAuthController::class, 'listado'])->name('listadopresos');

or you can change your blade like below

<a  class="btn aviso" href="javascript:window.open('{{ URL('listadopresos')}}','','width=600,height=600,left=50,top=50,toolbar=yes');void 0">Listado</a> 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading