- Introduced `CleanupNames` command to sanitize name fields by removing invalid characters, ensuring only letters, numbers, spaces, dashes, underscores, and dots are retained. - Implemented options for dry run, model-specific cleaning, database backup, and forced execution. - Updated `Init` command to call the new `cleanup:names` command. - Enhanced project and environment validation to enforce name sanitization rules. - Added `HasSafeNameAttribute` trait to relevant models for consistent name handling.
15 lines
253 B
PHP
15 lines
253 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
trait HasSafeNameAttribute
|
|
{
|
|
/**
|
|
* Set the name attribute - strip any HTML tags for safety
|
|
*/
|
|
public function setNameAttribute($value)
|
|
{
|
|
$this->attributes['name'] = strip_tags($value);
|
|
}
|
|
}
|