Path: blob/1.0-develop/app/Http/Requests/Admin/AdminFormRequest.php
10266 views
<?php12namespace Pterodactyl\Http\Requests\Admin;34use Illuminate\Foundation\Http\FormRequest;56abstract class AdminFormRequest extends FormRequest7{8/**9* The rules to apply to the incoming form request.10*/11abstract public function rules(): array;1213/**14* Determine if the user is an admin and has permission to access this15* form controller in the first place.16*/17public function authorize(): bool18{19if (is_null($this->user())) {20return false;21}2223return (bool) $this->user()->root_admin;24}2526/**27* Return only the fields that we are interested in from the request.28* This will include empty fields as a null value.29*/30public function normalize(?array $only = null): array31{32return $this->only($only ?? array_keys($this->rules()));33}34}353637