0

I got these routes:

    Route::get('prefix/list/{page?}/{size?}', ['as' => 'prefix.list', 'uses' => 'MyController@getList']);
    Route::post('prefix/list', ['as' => 'prefix.list', 'uses' => 'MyController@postList']);

When I call link_to_route() like so:

{{ link_to_route('prefix.list', $page, ['page' => $page, 'size' => $size]) }}

It creates this link:

http://my.site/prefix/list?page=5&size=12

But when I remove the post route, it renders correctly this:

http://my.site/prefix/list/5/12

I don't want to change the name of the routes because my system depends on them being the same. How can I solve this?

4

1 回答 1

1

您可以尝试仅更改路由文件中路由的顺序,以便 get 排在最后并覆盖帖子以达到link_to_route().

于 2016-11-19T18:46:51.477 回答