本文整理汇总了PHP中app\News::search方法的典型用法代码示例。如果您正苦于以下问题:PHP News::search方法的具体用法?PHP News::search怎么用?PHP News::search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\News
的用法示例。
在下文中一共展示了News::search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show(Request $request)
{
if (!$request->has('q')) {
return redirect('/' . LANG);
}
$params = $request->only('q');
$searchParams = explode(" ", trim($params['q']));
$productsResults = Product::search($searchParams);
$portfoliosResults = Portfolio::search($searchParams);
$newsResults = News::search($searchParams);
$tendersResults = Tender::search($searchParams);
$vacanciesResults = Vacancy::search($searchParams);
$sharesResults = Share::search($searchParams);
$experEdvicesResults = ExpertAdvice::search($searchParams);
$count = count($productsResults) + count($portfoliosResults) + count($newsResults) + count($tendersResults) + count($vacanciesResults) + count($sharesResults) + count($experEdvicesResults);
return view('search', ['products' => $productsResults, 'portfolios' => $portfoliosResults, 'news' => $newsResults, 'tenders' => $tendersResults, 'vacancies' => $vacanciesResults, 'shares' => $sharesResults, 'experEdvices' => $experEdvicesResults, 'count' => $count, 'title' => LANG . '_title', 'description' => LANG . '_description', 'adderss' => LANG . '_adderss', 'type' => 'news']);
}