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

41 lines
885 B
PHP
Raw Normal View History

<?php
2017-09-26 02:43:01 +00:00
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
2017-09-26 02:43:01 +00:00
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
namespace Pterodactyl\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
abstract class FrontendUserFormRequest extends FormRequest
{
abstract public function rules();
/**
* Determine if a user is authorized to access this endpoint.
*
* @return bool
*/
public function authorize()
{
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.
*
* @return array
*/
public function normalize()
{
return $this->only(
array_keys($this->rules())
);
}
}