mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Co-authored-by: Aditya Tripathi <aditya@climactic.co>
26 lines
573 B
PHP
26 lines
573 B
PHP
<?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);
|
|
}
|
|
}
|