cbcf62086f
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
29 lines
646 B
PHP
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())
|
|
);
|
|
}
|
|
}
|