 38c0641734
			
		
	
	38c0641734
	
	
	
		
			
			- Introduced `ValidationPatterns` class to standardize validation rules and messages for name and description fields across the application. - Updated various components and models to utilize the new validation patterns, ensuring consistent sanitization and validation logic. - Replaced the `HasSafeNameAttribute` trait with `HasSafeStringAttribute` to enhance attribute handling and maintain consistency in name sanitization. - Enhanced the `CleanupNames` command to align with the new validation rules, allowing for a broader range of valid characters in names.
		
			
				
	
	
		
			33 lines
		
	
	
		
			613 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			613 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Models;
 | |
| 
 | |
| use App\Traits\HasSafeStringAttribute;
 | |
| 
 | |
| class Tag extends BaseModel
 | |
| {
 | |
|     use HasSafeStringAttribute;
 | |
| 
 | |
|     protected $guarded = [];
 | |
| 
 | |
|     protected function customizeName($value)
 | |
|     {
 | |
|         return strtolower($value);
 | |
|     }
 | |
| 
 | |
|     public static function ownedByCurrentTeam()
 | |
|     {
 | |
|         return Tag::whereTeamId(currentTeam()->id)->orderBy('name');
 | |
|     }
 | |
| 
 | |
|     public function applications()
 | |
|     {
 | |
|         return $this->morphedByMany(Application::class, 'taggable');
 | |
|     }
 | |
| 
 | |
|     public function services()
 | |
|     {
 | |
|         return $this->morphedByMany(Service::class, 'taggable');
 | |
|     }
 | |
| }
 |