You've already forked lubo_comment_query
							
							
		
			
				
	
	
		
			25 lines
		
	
	
		
			580 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			580 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Models\Casts;
 | |
| 
 | |
| use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
 | |
| use Ramsey\Uuid\Uuid as UuidConvert;
 | |
| use Ramsey\Uuid\UuidInterface;
 | |
| 
 | |
| class Uuid implements CastsAttributes
 | |
| {
 | |
|     public function get($model, string $key, $value, array $attributes): ?UuidInterface
 | |
|     {
 | |
|         if ($value !== null && UuidConvert::isValid($value)) {
 | |
|             return UuidConvert::fromString($value);
 | |
|         }
 | |
| 
 | |
|         return null;
 | |
|     }
 | |
| 
 | |
|     public function set($model, string $key, $value, array $attributes): ?string
 | |
|     {
 | |
|         return (string) $value;
 | |
|     }
 | |
| }
 |