mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 06:32:40 +01:00
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Invoice Ninja (https://invoiceninja.com).
|
||
|
*
|
||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||
|
*
|
||
|
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||
|
*
|
||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||
|
*/
|
||
|
|
||
|
namespace App\Http\Requests\Account;
|
||
|
|
||
|
use App\Http\Requests\Request;
|
||
|
use App\Http\ValidationRules\Account\BlackListRule;
|
||
|
use App\Http\ValidationRules\Account\EmailBlackListRule;
|
||
|
use App\Http\ValidationRules\NewUniqueUserRule;
|
||
|
use App\Utils\Ninja;
|
||
|
|
||
|
class UpdateAccountRequest extends Request
|
||
|
{
|
||
|
/**
|
||
|
* Determine if the user is authorized to make this request.
|
||
|
*
|
||
|
* @return bool
|
||
|
*/
|
||
|
public function authorize()
|
||
|
{
|
||
|
return auth()->user()->isAdmin() || auth()->user()->isOwner();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get the validation rules that apply to the request.
|
||
|
*
|
||
|
* @return array
|
||
|
*/
|
||
|
public function rules()
|
||
|
{
|
||
|
return [
|
||
|
'set_react_as_default_ap' => 'required|bail|bool'
|
||
|
];
|
||
|
}
|
||
|
|
||
|
protected function prepareForValidation()
|
||
|
{
|
||
|
$input = $this->all();
|
||
|
|
||
|
$cleaned_input = array_intersect_key( $input, array_flip(['set_react_as_default_ap']));
|
||
|
|
||
|
$this->replace($cleaned_input);
|
||
|
|
||
|
}
|
||
|
}
|