由laravel自动添加的表单操作URL中的奇怪段

I have this form:

{!!Form::open(['route'=>'fastsearch.show'])!!}

In routes.php I have:

Route::resource('fastsearch','SearchController');

And in SearchController i have a method show() that sends the return to a view called fastsearch (which is fastsearch.blade.php)

If I look into the source of the page where the form is, I see this:

<form method="POST" action="http://localhost:8000/fastsearch/%7Bfastsearch%7D" accept-charset="UTF-8"><input name="_token" type="hidden" value="hLcSkGk2p5XfTkFEv2pwGgcVQB18vHQIGMpOVGpM">

If I put some data in the form and click Submit, I get this error:

MethodNotAllowedHttpException in RouteCollection.php line 201:

My question is why the extra segment in the action URL (this one: /%7Bfastsearch%7D). Is something wrong with the routes ?

(Just to give you all the details, this a general search form that lies on almost every page in order to allow the users to run a quick search from almost every page they might be at that time. So it doesn’t matter if you’re on Home page or on /Home/Subpage/SubSubPage{wildcard}{wildcard} you can still see the form and use it)

You're trying to send a post request to a route expecting a get request.

Change:

{!! Form::open(['route'=>'fastsearch.show']) !!}

To:

{!! Form::open(['route'=>'fastsearch.index']) !!}

Where index is the name of the action you wish to receive the post request.

You're probably better off using specific named routes for this though.

Route::post('fastsearch', [
    'as' => 'fastsearch.search', 'uses' => 'SearchController@search'
]);

Take a look at http://laravel.com/docs/5.1/controllers#restful-resource-controllers for more info on resource controllers and http://laravel.com/docs/5.1/routing#named-routes for more on named routes.

You can also use ./artisan route:list for a list of existing routes.