所以这是我的控制器:
class PostsController extends BaseController
{
public function postSearch()
{
$q = Input::get('username');
$posts = DB::table('users')->whereRaw(
"MATCH(username) AGAINST(? IN BOOLEAN MODE)",
array($q)
)->get();
return View::make('posts.index', compact('users'));
}
} 和我的路线:
Route::get('posts/index', function()
{
return View::make('posts/index');
});
Route::post('posts/index', array('as' => 'posts.index','uses' => 'PostsController@postSearch'));
和我的HTML:
<div class="search">
{{ Form::model(null, array('route' => array('posts.index'))) }}
{{ Form::text('username', null, array( 'placeholder' => 'Search query...' )) }}
{{ Form::submit('Search') }}
{{ Form::close() }}
</div>
问题是它给我错误:
MethodNotAllowedHttpException
所以我希望用户能够在索引页面中搜索并在表格的diffiere页面中给出结果如何使结果显示以及这是什么错误