Ctrl K
ComunidadGuías…

app/Traits/HasSafeStringAttribute.php

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
<?php

namespace App\Traits;

trait HasSafeStringAttribute
{
    /**
     * Set the name attribute - strip any HTML tags for safety
     */
    public function setNameAttribute($value)
    {
        $sanitized = strip_tags($value);
        $this->attributes['name'] = $this->customizeName($sanitized);
    }

    protected function customizeName($value)
    {
        return $value; // Default: no customization
    }

    public function setDescriptionAttribute($value)
    {
        $this->attributes['description'] = $value === null ? null : strip_tags($value);
    }
}