2017-06-25 20:31:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
2017-08-31 02:11:14 +00:00
|
|
|
abstract class FrontendUserFormRequest extends FormRequest
|
2017-06-25 20:31:50 +00:00
|
|
|
{
|
2022-10-14 16:59:20 +00:00
|
|
|
abstract public function rules(): array;
|
2017-08-31 02:11:14 +00:00
|
|
|
|
2017-06-25 20:31:50 +00:00
|
|
|
/**
|
|
|
|
* Determine if a user is authorized to access this endpoint.
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function authorize(): bool
|
2017-06-25 20:31:50 +00:00
|
|
|
{
|
2021-01-23 20:33:34 +00:00
|
|
|
return !is_null($this->user());
|
2017-06-25 20:31:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return only the fields that we are interested in from the request.
|
|
|
|
* This will include empty fields as a null value.
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function normalize(): array
|
2017-06-25 20:31:50 +00:00
|
|
|
{
|
|
|
|
return $this->only(
|
|
|
|
array_keys($this->rules())
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|