firefly-iii/app/Http/Requests/UserFormRequest.php

60 lines
1.3 KiB
PHP
Raw Normal View History

2016-12-15 15:56:31 -06:00
<?php
/**
* UserFormRequest.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
2017-03-24 09:01:53 -05:00
declare(strict_types=1);
2016-12-15 15:56:31 -06:00
namespace FireflyIII\Http\Requests;
/**
* Class UserFormRequest
*
*
* @package FireflyIII\Http\Requests
*/
class UserFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return auth()->check();
}
/**
* @return array
*/
public function getUserData(): array
{
return [
2017-01-21 01:32:23 -06:00
'email' => $this->string('email'),
2017-03-24 09:01:53 -05:00
'blocked' => $this->integer('blocked') === 1,
2017-01-21 01:32:23 -06:00
'blocked_code' => $this->string('blocked_code'),
'password' => $this->string('password'),
2016-12-15 15:56:31 -06:00
];
}
/**
* @return array
*/
public function rules()
{
return [
'id' => 'required|exists:users,id',
2017-03-24 09:01:53 -05:00
'email' => 'email|required',
2016-12-15 15:56:31 -06:00
'password' => 'confirmed',
'blocked_code' => 'between:0,30',
'blocked' => 'between:0,1|numeric',
];
}
}