Files
2026-08-08 18:27:38 +08:00

35 lines
947 B
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Article;
use App\Models\News;
use App\Models\Product;
use App\Models\Solution;
use Illuminate\View\View;
class HomeController extends Controller
{
public function index(): View
{
$products = Product::published()->take(3)->get();
$articles = Article::published()->take(3)->get();
$solutions = Solution::published()->orderBy('sort')->take(4)->get();
$news = News::published()->take(3)->get();
// 首页 Hero 轮播(后台「首页轮播」管理;mode=single 时为独立单图)
$heroMode = \App\Models\Setting::get('hero_mode', 'carousel');
$heroSlides = \App\Models\HeroSlide::location('home')->active()->ordered()->get();
return view('home', compact('products', 'articles', 'solutions', 'news', 'heroSlides', 'heroMode'));
}
public function about(): View
{
return view('about');
}
}