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

68
app/Models/Mensaje.php Executable file
View File

@@ -0,0 +1,68 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Mensaje extends Model
{
use HasFactory;
protected $table = 'mensajes';
protected $fillable = [
'nombre',
'email',
'telefono',
'mensaje',
'leido',
];
protected $casts = [
'leido' => 'boolean',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/**
* Scope para filtrar mensajes no leídos
*/
public function scopeNoLeidos(Builder $query): Builder
{
return $query->where('leido', false);
}
/**
* Marcar mensaje como leído
*/
public function marcarLeido(): bool
{
return $this->update(['leido' => true]);
}
/**
* Marcar mensaje como no leído
*/
public function marcarNoLeido(): bool
{
return $this->update(['leido' => false]);
}
/**
* Obtener iniciales del nombre
*/
public function getInicialesAttribute(): string
{
$nombres = explode(' ', $this->nombre);
$iniciales = '';
foreach ($nombres as $nombre) {
if (! empty($nombre)) {
$iniciales .= strtoupper($nombre[0]);
}
}
return $iniciales;
}
}