2017-06-25 15:31:50 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Requests;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
2017-08-30 21:11:14 -05:00
|
|
|
abstract class FrontendUserFormRequest extends FormRequest
|
2017-06-25 15:31:50 -05:00
|
|
|
{
|
2022-10-14 10:59:20 -06:00
|
|
|
abstract public function rules(): array;
|
2017-08-30 21:11:14 -05:00
|
|
|
|
2017-06-25 15:31:50 -05:00
|
|
|
/**
|
|
|
|
* Determine if a user is authorized to access this endpoint.
|
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function authorize(): bool
|
2017-06-25 15:31:50 -05:00
|
|
|
{
|
2021-01-23 12:33:34 -08:00
|
|
|
return !is_null($this->user());
|
2017-06-25 15:31:50 -05: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 10:59:20 -06:00
|
|
|
public function normalize(): array
|
2017-06-25 15:31:50 -05:00
|
|
|
{
|
|
|
|
return $this->only(
|
|
|
|
array_keys($this->rules())
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|