master
unknown 4 years ago
parent 742bd65e46
commit e2187bfa40
  1. 6
      app/Http/Controllers/Home/ArticleController.php

@ -26,6 +26,7 @@ class ArticleController extends Controller
'slug', 'author', 'description',
'cover', 'is_top', 'created_at'
)
->orderBy('is_top', 'desc')
->orderBy('created_at', 'desc')
->with(['category', 'tags'])
->paginate(10);
@ -177,6 +178,7 @@ class ArticleController extends Controller
public function search(Request $request, Article $articleModel)
{
if (Agent::isRobot()) {
abort(404);
}
@ -184,11 +186,11 @@ class ArticleController extends Controller
$wd = clean($request->input('wd'));
$id = $articleModel->searchArticleGetId($wd);
$articles = Article::select(
$articles = Article::select([
'id', 'category_id', 'title',
'author', 'description', 'cover',
'is_top', 'created_at'
)
])
->whereIn('id', $id)
->orderBy('created_at', 'desc')
->with(['category', 'tags'])

Loading…
Cancel
Save