Initial commit: Lash Vanshy - Complete project with admin panel, gallery, products, and contact
This commit is contained in:
49
app/Http/Controllers/Frontend/HomeController.php
Executable file
49
app/Http/Controllers/Frontend/HomeController.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Configuracion;
|
||||
use App\Models\Galeria;
|
||||
use App\Models\Producto;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Mostrar página de inicio
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
$configuracion = Configuracion::allAsArray();
|
||||
|
||||
// Productos destacados para el home
|
||||
$productosDestacados = Producto::activo()
|
||||
->where('destacado', true)
|
||||
->orderBy('orden', 'asc')
|
||||
->take(6)
|
||||
->get();
|
||||
|
||||
// Galería para mostrar en home (solo activos)
|
||||
$galeria = Galeria::activo()
|
||||
->ordenado()
|
||||
->take(8)
|
||||
->get();
|
||||
|
||||
return view('frontend.home.index', compact(
|
||||
'productosDestacados',
|
||||
'galeria',
|
||||
'configuracion'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mostrar página de contacto
|
||||
*/
|
||||
public function contacto(): View
|
||||
{
|
||||
$configuracion = Configuracion::allAsArray();
|
||||
|
||||
return view('frontend.contacto.index', compact('configuracion'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user