mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 21:46:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			710 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			710 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Requests\Admin;
 | |
| 
 | |
| use App\Models\DatabaseHost;
 | |
| use Illuminate\Contracts\Validation\Validator;
 | |
| 
 | |
| class DatabaseHostFormRequest extends AdminFormRequest
 | |
| {
 | |
|     public function rules(): array
 | |
|     {
 | |
|         if ($this->method() !== 'POST') {
 | |
|             return DatabaseHost::getRulesForUpdate($this->route()->parameter('host'));
 | |
|         }
 | |
| 
 | |
|         return DatabaseHost::getRules();
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Modify submitted data before it is passed off to the validator.
 | |
|      */
 | |
|     protected function getValidatorInstance(): Validator
 | |
|     {
 | |
|         if (!$this->filled('node_id')) {
 | |
|             $this->merge(['node_id' => null]);
 | |
|         }
 | |
| 
 | |
|         return parent::getValidatorInstance();
 | |
|     }
 | |
| }
 | 
