简体   繁体   中英

Laravel - Page not found even that the Route exists

I have this route:

Route::get('/dashboard/tags/edit/{tag}','UsersController@editTagIndex');

and this is my form action: action="/dashboard/tags/edit/{{$tag->id}}" method="get"

it gives me Page not found as there is no route !

I have tried: php artisan route:list

and the route exists

what makes no sense is I have another route :

Route::get('/dashboard/posts/edit/{post}','UsersController@editPostIndex');

and it works perfectly

Hi there maybe this will do the trick:

action="{{ action('UsersController@editTagIndex', [tag => $tag_id]) }}"

Good Luck

也许这应该是发布请求,因为您正在提交编辑功能。

The problem was that I had this function in my Tag Model

public function getRouteKeyName()
{
    return 'name';
}

so instead of passing it $tag->id in the form action

I passed it $tag->name

Thank you all for trying to help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM