调整首页和分类页的院所新闻
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Article;
|
||||
use App\Models\Category;
|
||||
|
||||
class CategoryController extends Controller
|
||||
@@ -36,13 +37,22 @@ class CategoryController extends Controller
|
||||
$template = 'photos';
|
||||
}
|
||||
}
|
||||
//院所新闻
|
||||
if ($category->id == 66) {
|
||||
$articles = Article::ByCategory([66, 67, 60, 61, 17, 26,])
|
||||
->where('status', 1)
|
||||
->latest('sort')
|
||||
->latest('created_at')
|
||||
->paginate();
|
||||
|
||||
} else {
|
||||
$articles = $category->relations($category->type)
|
||||
->where('status', 1)
|
||||
->latest('sort')
|
||||
->latest('created_at')
|
||||
->paginate();
|
||||
}
|
||||
|
||||
$articles = $category->relations($category->type)
|
||||
->where('status', 1)
|
||||
->latest('sort')
|
||||
->latest('created_at')
|
||||
->paginate();
|
||||
|
||||
$parent = $category;
|
||||
if ($category->childrens->isEmpty() && $category->parent) {
|
||||
|
||||
@@ -13,16 +13,20 @@ class IndexController extends Controller
|
||||
|
||||
/**
|
||||
* Notes: 首页
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/6/1 9:11
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$ysxw = Article::where('status', 1)
|
||||
->ByCategory([66, 67, 60, 61, 17, 26,])
|
||||
->latest('sort')
|
||||
->latest()
|
||||
->take(7)
|
||||
->get();
|
||||
|
||||
$top_adverts = Advert::where('category_id', 33)->latest('sort')->first();
|
||||
$cent_adverts = Advert::where('category_id', 33)->latest('sort')->first();
|
||||
|
||||
return view('index.index', compact('top_adverts', 'top_adverts'));
|
||||
return view('index.index', compact('ysxw'));
|
||||
}
|
||||
|
||||
public function search(Request $request)
|
||||
|
||||
Reference in New Issue
Block a user