Initial commit: Lash Vanshy - Complete project with admin panel, gallery, products, and contact
This commit is contained in:
32
app/Http/Controllers/Admin/DashboardController.php
Executable file
32
app/Http/Controllers/Admin/DashboardController.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Galeria;
|
||||
use App\Models\Mensaje;
|
||||
use App\Models\Producto;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
/**
|
||||
* Mostrar el dashboard principal
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
// Obtener estadísticas
|
||||
$stats = [
|
||||
'mensajes_no_leidos' => Mensaje::noLeidos()->count(),
|
||||
'total_modelos' => Galeria::count(),
|
||||
'total_productos' => Producto::count(),
|
||||
'productos_destacados' => Producto::where('destacado', true)->count(),
|
||||
'modelos_activos' => Galeria::where('activo', true)->count(),
|
||||
];
|
||||
|
||||
// Mensajes recientes
|
||||
$mensajes_recientes = Mensaje::orderBy('created_at', 'desc')->take(5)->get();
|
||||
|
||||
return view('admin.dashboard.index', compact('stats', 'mensajes_recientes'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user