Initial commit: Lash Vanshy - Complete project with admin panel, gallery, products, and contact

This commit is contained in:
2026-04-08 00:23:16 -06:00
commit e07e065791
111 changed files with 17939 additions and 0 deletions

75
app/Models/Configuracion.php Executable file
View File

@@ -0,0 +1,75 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Configuracion extends Model
{
use HasFactory;
protected $table = 'configuraciones';
protected $fillable = [
'clave',
'valor',
'descripcion',
];
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* Obtener configuración por clave
*
* @param string $clave La clave de configuración
* @param mixed $default Valor por defecto si no existe
* @return mixed
*/
public static function get(string $clave, $default = null)
{
$config = self::where('clave', $clave)->first();
if (! $config) {
return $default;
}
return $config->valor;
}
/**
* Obtener todas las configuraciones como array asociativo
*/
public static function allAsArray(): array
{
return self::pluck('valor', 'clave')->toArray();
}
/**
* Establecer una configuración
*
* @param string $clave La clave de configuración
* @param mixed $valor El valor a guardar
*/
public static function set(string $clave, $valor): self
{
$config = self::where('clave', $clave)->firstOrNew(['clave' => $clave]);
$config->valor = $valor;
$config->save();
return $config;
}
/**
* Eliminar una configuración
*
* @param string $clave La clave de configuración
*/
public static function remove(string $clave): bool
{
return self::where('clave', $clave)->delete() > 0;
}
}