misc_pterodactyl-panel/app/Http/Requests/FrontendUserFormRequest.php

30 lines
646 B
PHP
Raw Normal View History

<?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
{
2021-01-23 20:33:34 +00:00
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())
);
}
}