mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 11:56:52 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			638 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			638 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Http\Requests;
 | 
						|
 | 
						|
use Illuminate\Foundation\Http\FormRequest;
 | 
						|
 | 
						|
abstract class FrontendUserFormRequest extends FormRequest
 | 
						|
{
 | 
						|
    abstract public function rules(): array;
 | 
						|
 | 
						|
    /**
 | 
						|
     * Determine if a user is authorized to access this endpoint.
 | 
						|
     */
 | 
						|
    public function authorize(): bool
 | 
						|
    {
 | 
						|
        return !is_null($this->user());
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Return only the fields that we are interested in from the request.
 | 
						|
     * This will include empty fields as a null value.
 | 
						|
     */
 | 
						|
    public function normalize(): array
 | 
						|
    {
 | 
						|
        return $this->only(
 | 
						|
            array_keys($this->rules())
 | 
						|
        );
 | 
						|
    }
 | 
						|
}
 |