misc_pterodactyl-panel/app/Http/Requests/Admin/UserFormRequest.php
Dane Everitt 4457634127
Fix user creation to use UUIDs correctly
Also updates the notification send method to be cleaner and more maintainable
2018-01-01 12:13:08 -06:00

27 lines
775 B
PHP

<?php
namespace Pterodactyl\Http\Requests\Admin;
use Pterodactyl\Models\User;
class UserFormRequest extends AdminFormRequest
{
/**
* Rules to apply to requests for updating or creating a user
* in the Admin CP.
*/
public function rules()
{
$rules = collect(User::getCreateRules());
if ($this->method() === 'PATCH') {
$rules = collect(User::getUpdateRulesForId($this->route()->parameter('user')->id))->merge([
'ignore_connection_error' => ['sometimes', 'nullable', 'boolean'],
]);
}
return $rules->only([
'email', 'username', 'name_first', 'name_last', 'password',
'language', 'ignore_connection_error', 'root_admin',
])->toArray();
}
}