misc_pterodactyl-panel/app/Http/Requests/FrontendUserFormRequest.php
Matthew Penner cbcf62086f
Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00

29 lines
646 B
PHP

<?php
namespace Pterodactyl\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())
);
}
}