👁 查看:DashboardController.php
路径:/home/boguraj1/.trash/app.1/Http/Controllers/Admin/DashboardController.php
大小:806 B · 修改:2026-06-25 22:26:18 · 权限:0644 · 可写
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Newspaper;
use App\Models\NewspaperPage;
use App\Models\Hotspot;
class DashboardController extends Controller
{
public function index()
{
$stats = [
'total_newspapers' => Newspaper::count(),
'published' => Newspaper::where('status', 'published')->count(),
'drafts' => Newspaper::where('status', 'draft')->count(),
'total_pages' => NewspaperPage::count(),
'total_hotspots' => Hotspot::count(),
];
$recentNewspapers = Newspaper::with('pages')
->orderByDesc('publish_date')
->limit(5)
->get();
return view('admin.dashboard', compact('stats', 'recentNewspapers'));
}
}