本文整理汇总了PHP中app\Article::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::search方法的具体用法?PHP Article::search怎么用?PHP Article::search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Article
的用法示例。
在下文中一共展示了Article::search方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index(urlRequest $request)
{
//query
if ($search = $request->query('q')) {
$articles = Article::search($search)->orderBy('created_at', 'desc')->simplepaginate(18);
} elseif ($search = $request->query('id')) {
//查找伪id(photo)
$search = \App\Article::where('photo', $search)->firstOrFail()->id;
$articles = DB::table('articles')->where('id', '<=', $search)->orderBy('created_at', 'desc')->simplepaginate(18);
//伪搜索结果
$search = $request->query('id');
} else {
//DB::代替Article::
$articles = DB::table('articles')->orderBy('created_at', 'desc')->simplepaginate(18);
}
//已经点赞{!!$articles->appends(Request::except('page'))->render()!!}
//$f = DB::table('votes')->whereuser_id(Auth::user()->id)->lists('votable_id');
//http://example.com/custom/url?page=N, you should pass custom/url to the setPath
$articles->setPath('articles');
//sidebar
$hotimgs = \App\Article::where('type', 'LIKE', "%jpg%")->orderBy('vote_count', 'desc')->take(10)->get();
//return $hotimgs;
$hotreplies = \App\Reply::orderBy('vote_count', 'desc')->limit(10)->get();
return view('articles.index', compact('articles', 'search', 'hotimgs', 'hotreplies'));
}
示例2: index
public function index(Request $request)
{
$arts = Article::search($request->title)->orderBy('id', 'DESC')->paginate(5);
$arts->each(function ($arts) {
$arts->category;
$arts->user;
});
return view('admin.articles.index')->with('arts', $arts);
}
示例3: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$articles = Article::search($request->title)->desc()->paginado();
$articles->each(function ($articles) {
$articles->category;
$articles->user;
});
return view('admin.articles.index')->with('articles', $articles);
}
示例4: GIF
public function GIF(urlRequest $request)
{
if ($search = $request->query('q')) {
$articles = \App\Article::search($search)->where('type', '.mp4')->orderBy('created_at', 'desc')->simplepaginate(18);
} elseif ($search = $request->query('id')) {
$search = \App\Article::where('photo', $search)->firstOrFail()->id;
$articles = DB::table('articles')->where('type', '.mp4')->where('id', '<=', $search)->orderBy('created_at', 'desc')->simplepaginate(18);
$search = $request->query('id');
} else {
$articles = DB::table('articles')->where('type', '.mp4')->orderBy('created_at', 'desc')->simplepaginate(18);
}
$articles->setPath('GIF');
$hotimgs = \App\Article::where('type', 'LIKE', "%jpg%")->orderBy('vote_count', 'desc')->take(10)->get();
$hotreplies = \App\Reply::orderBy('vote_count', 'desc')->limit(10)->get();
return view('articles.index', compact('articles', 'search', 'hotimgs', 'hotreplies'));
}
示例5: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$articles = Article::search($request->title)->orderBy('created_at', 'DESC')->paginate(8);
return view('admin.articles.index', compact('articles'));
}