feat(cleanup): add command for sanitizing name fields across models
- 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.
This commit is contained in:
		@@ -2,13 +2,14 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Models;
 | 
			
		||||
 | 
			
		||||
use App\Traits\HasSafeNameAttribute;
 | 
			
		||||
use Illuminate\Database\Eloquent\Casts\Attribute;
 | 
			
		||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
 | 
			
		||||
use Illuminate\Database\Eloquent\SoftDeletes;
 | 
			
		||||
 | 
			
		||||
class StandalonePostgresql extends BaseModel
 | 
			
		||||
{
 | 
			
		||||
    use HasFactory, SoftDeletes;
 | 
			
		||||
    use HasFactory, HasSafeNameAttribute, SoftDeletes;
 | 
			
		||||
 | 
			
		||||
    protected $guarded = [];
 | 
			
		||||
 | 
			
		||||
@@ -322,7 +323,7 @@ class StandalonePostgresql extends BaseModel
 | 
			
		||||
        $parsedCollection = collect($metrics)->map(function ($metric) {
 | 
			
		||||
            return [
 | 
			
		||||
                (int) $metric['time'],
 | 
			
		||||
                (float) ($metric['percent'] ?? 0.0)
 | 
			
		||||
                (float) ($metric['percent'] ?? 0.0),
 | 
			
		||||
            ];
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user