0

Route [paslon.create] not defined.

<a href="{{route('daftar.create')}}" class="btn btn-primary btn-sm mb-3">tambah1</a>

controller

public function create()
    {
        return view('daftar.create');
    }

web.php

Route::get('/create', function () { return view('/daftar/create'); });

my solution is changing in <a href="/create" class="btn btn-primary btn-sm mb-3">tambah1</a>

and in web Route::get('/create', function () { return view('daftar.create'); });

but I don't know if it will be safe or not


Rio Jaka
  • 1
  • 1
  • Please check your `routes/web.php` file for `paslon.create` or resource route associated with `paslon`. – linktoahref Jul 11 '23 at 04:11
  • this in my web.php ```Route::get('/create', function () { return view('/daftar/create'); });''' – Rio Jaka Jul 11 '23 at 04:19
  • 2
    `Route::get(...)->name('daftar.create')`, read [the manual](https://laravel.com/docs/10.x/routing#named-routes). if you want to do a resource controller, please do it [properly](https://laravel.com/docs/10.x/controllers#resource-controllers). – Bagus Tesa Jul 11 '23 at 04:30
  • Does this answer your question? [Laravel says "Route not defined"](https://stackoverflow.com/questions/28714675/laravel-says-route-not-defined) – linktoahref Jul 11 '23 at 04:32
  • Why are you not using your controller? `Route::get('/create', 'Controller@create');` – Ankit Jindal Jul 11 '23 at 04:42

2 Answers2

0

You're calling route with name and for that you have to define name first in the routes/web.php

Route::get('/create', function () { 
   return view('/daftar/create'); 
})->name('daftar.create');

For more better understanding checkout the documentation:

https://laravel.com/docs/10.x/routing#named-routes

Kamran Allana
  • 543
  • 1
  • 6
  • 25
0

By default your routes doesn't have any name, you can see it typing in console:

php artisan route:list

You will see route names. You need to declare name yourself

Route::get('/create', function () { return view('/daftar/create'); })->name('daftar.create');
Marijus12
  • 38
  • 6