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:
@@ -13,6 +13,7 @@ use App\Jobs\RegenerateSslCertJob;
|
||||
use App\Notifications\Server\Reachable;
|
||||
use App\Notifications\Server\Unreachable;
|
||||
use App\Services\ConfigurationRepository;
|
||||
use App\Traits\HasSafeNameAttribute;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
@@ -164,6 +165,8 @@ class Server extends BaseModel
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
use HasSafeNameAttribute;
|
||||
|
||||
public function type()
|
||||
{
|
||||
return 'server';
|
||||
|
||||
Reference in New Issue
Block a user