mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 16:56:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			775 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			775 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace Pterodactyl\Http\Requests\Admin;
 | 
						|
 | 
						|
use Pterodactyl\Models\User;
 | 
						|
 | 
						|
class UserFormRequest extends AdminFormRequest
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * Rules to apply to requests for updating or creating a user
 | 
						|
     * in the Admin CP.
 | 
						|
     */
 | 
						|
    public function rules()
 | 
						|
    {
 | 
						|
        $rules = collect(User::getCreateRules());
 | 
						|
        if ($this->method() === 'PATCH') {
 | 
						|
            $rules = collect(User::getUpdateRulesForId($this->route()->parameter('user')->id))->merge([
 | 
						|
                'ignore_connection_error' => ['sometimes', 'nullable', 'boolean'],
 | 
						|
            ]);
 | 
						|
        }
 | 
						|
 | 
						|
        return $rules->only([
 | 
						|
            'email', 'username', 'name_first', 'name_last', 'password',
 | 
						|
            'language', 'ignore_connection_error', 'root_admin',
 | 
						|
        ])->toArray();
 | 
						|
    }
 | 
						|
}
 |