6
0
Fork 0
release
panliang 2022-05-31 09:57:30 +08:00
parent 59ee6ece0a
commit 53f8327a94
1 changed files with 3 additions and 8 deletions

View File

@ -37,16 +37,11 @@ class ArticleController extends Controller
public function index(Request $request)
{
$cate = (string) $request->query('cate');
$cate = (string) $request->query('cate', 3);
$key = (string) $request->query('key');
$categoryId = Arr::get([
'help'=> app_settings('app.article_help'),
'agreement'=> app_settings('app.article_agreement'),
'health'=> app_settings('app.article_health'),
], $cate);
$query = Article::where('is_show', 1);
if ($categoryId) {
$query->where('category_id', $categoryId);
if ($cate) {
$query->where('category_id', $cate);
}
if ($key) {
$query->where('title', 'like', '%'.$key.'%');