mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 03:16:52 +01:00 
			
		
		
		
	 8261184b57
			
		
	
	
		8261184b57
		
			
		
	
	
	
	
		
			
			* Just skip this table because it no longer exists * Add postgresql * This no longer needs to be there * These are the same output in mysql, but different in postgresql * Fix these migrations for postgresql * This table no longer exists * This is expected to be a json column for json operations, required for postgresql * Shoot for the stars * Fix pint * Why was this missing * Updates * Restore this * This needs to be explicit * Don’t like strings * Fix these classes * Use different method to compare dates * Apparently postgresql doesn’t like case insensitivity * Postgresql orders it backwards * Ordered different by postgresql * Unnecessary and breaking * Make sure the order is correct for postresql * Fix this with the order too * Remove this * Force email to be lowercased * Update app/Models/User.php
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Filament\Admin\Resources\UserResource\Pages;
 | |
| 
 | |
| use App\Filament\Admin\Resources\UserResource;
 | |
| use App\Models\Role;
 | |
| use App\Services\Users\UserCreationService;
 | |
| use Filament\Resources\Pages\CreateRecord;
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| 
 | |
| class CreateUser extends CreateRecord
 | |
| {
 | |
|     protected static string $resource = UserResource::class;
 | |
| 
 | |
|     protected static bool $canCreateAnother = false;
 | |
| 
 | |
|     private UserCreationService $service;
 | |
| 
 | |
|     public function boot(UserCreationService $service): void
 | |
|     {
 | |
|         $this->service = $service;
 | |
|     }
 | |
| 
 | |
|     protected function getHeaderActions(): array
 | |
|     {
 | |
|         return [
 | |
|             $this->getCreateFormAction()->formId('form'),
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     protected function getFormActions(): array
 | |
|     {
 | |
|         return [];
 | |
|     }
 | |
| 
 | |
|     protected function prepareForValidation($attributes): array
 | |
|     {
 | |
|         $attributes['data']['email'] = mb_strtolower($attributes['data']['email']);
 | |
| 
 | |
|         return $attributes;
 | |
|     }
 | |
| 
 | |
|     protected function handleRecordCreation(array $data): Model
 | |
|     {
 | |
|         $data['root_admin'] = false;
 | |
| 
 | |
|         $roles = $data['roles'];
 | |
|         $roles = collect($roles)->map(fn ($role) => Role::findById($role));
 | |
|         unset($data['roles']);
 | |
| 
 | |
|         $user = $this->service->handle($data);
 | |
| 
 | |
|         $user->syncRoles($roles);
 | |
| 
 | |
|         return $user;
 | |
|     }
 | |
| }
 |