私のlaravelのウェブサイトにこの検索機能があります。しかし、にgit hookを使ってデプロイすると、検索機能が正しく動作しません。検索機能はlocalhostでは正常に動作しますが、VPSでは正しく動作しません
私はローカルホストでの検索ボタンをクリックすると、それはこのようなのURLを生成します。http://127.0.0.1:8000/search?query=test&location=&keywords=&_token=I5BDCrqHtdwvsSwrHTrdAAGYfdukPCgU3OAGDySw
しかしとき何も起こらない展開サーバーに、それだけでいくつかのポストバック負荷を行います。
SearchController.php
public function getSearch(Request $request)
{
$this->validate($request, [
'query' => 'required_without_all:keywords,location',
], ['query.required_without_all' => 'Please fill atleast one field.']
);
$query = $request['query'];
$location = $request['location'];
$keywords = $request['keywords'];
if (isset($location) && isset($query) && $keywords) {
$posts = Post::orderBy('created_at', 'desc')->where('title', 'like', '%' . $query . '%')->where('location', 'like', $location)->where('body', 'like', $keywords)->paginate(5);
}
.......
else {
$query = '';
$location = '';
$posts = Post::orderBy('created_at', 'desc')->where('location', 'like', $location)->paginate(5);
}
return view('includes.search-index', ['posts' => $posts]);
}
ルート/ web.php
Route::get('/search', [
'uses' => '[email protected]',
'as' => 'search'
]);
search.blade.php
<form action="{{ route('search') }}" method="get" >
.....
</form>
何か考えですか?要求が通過していないようですか?私は空の要求を持っているので?
'索?クエリ=テスト&場所=&キーワード=&_トークン= 4RYLKod1wTRxlblKKpRzKa6Z4YQrAzELjJNP66ti'でなければなりません。戻り値は 'test'でなければなりません。 – Joseph