Initial commit: Lash Vanshy - Complete project with admin panel, gallery, products, and contact
This commit is contained in:
36
app/Http/Controllers/Frontend/GaleriaController.php
Executable file
36
app/Http/Controllers/Frontend/GaleriaController.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Galeria;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class GaleriaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Mostrar galería pública
|
||||
*/
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$tipo = $request->get('tipo', 'todos');
|
||||
|
||||
$query = Galeria::activo()->ordenado();
|
||||
|
||||
if ($tipo !== 'todos') {
|
||||
$query->where('tipo', $tipo);
|
||||
}
|
||||
|
||||
$galeria = $query->paginate(12);
|
||||
|
||||
// Obtener estadísticas para los filtros
|
||||
$stats = [
|
||||
'total' => Galeria::activo()->count(),
|
||||
'imagenes' => Galeria::activo()->where('tipo', 'imagen')->count(),
|
||||
'videos' => Galeria::activo()->where('tipo', 'video')->count(),
|
||||
];
|
||||
|
||||
return view('frontend.galeria.index', compact('galeria', 'stats', 'tipo'));
|
||||
}
|
||||
}
|
||||
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'));
|
||||
}
|
||||
}
|
||||
48
app/Http/Controllers/Frontend/ProductoController.php
Executable file
48
app/Http/Controllers/Frontend/ProductoController.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Producto;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ProductoController extends Controller
|
||||
{
|
||||
/**
|
||||
* Mostrar lista de productos/servicios
|
||||
*/
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$categoria = $request->get('categoria', 'todos');
|
||||
|
||||
$query = Producto::activo()->orderBy('orden', 'asc');
|
||||
|
||||
if ($categoria !== 'todos') {
|
||||
$query->where('categoria', $categoria);
|
||||
}
|
||||
|
||||
$productos = $query->paginate(12);
|
||||
|
||||
// Obtener categorías únicas
|
||||
$categorias = Producto::activo()
|
||||
->distinct()
|
||||
->pluck('categoria')
|
||||
->filter()
|
||||
->values();
|
||||
|
||||
// Productos destacados
|
||||
$destacados = Producto::activo()
|
||||
->where('destacado', true)
|
||||
->orderBy('orden', 'asc')
|
||||
->take(4)
|
||||
->get();
|
||||
|
||||
return view('frontend.productos.index', compact(
|
||||
'productos',
|
||||
'categorias',
|
||||
'destacados',
|
||||
'categoria'
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user