Home > OS >  Route [listadopresos] not defined IN laravel 8
Route [listadopresos] not defined IN laravel 8

Time:01-31

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

    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   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

CodePudding user response:

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   href="javascript:window.open('{{ URL('listadopresos')}}','','width=600,height=600,left=50,top=50,toolbar=yes');void 0">Listado</a> 
  • Related