2022-06-25 14:24:14 +02:00
|
|
|
<?php
|
2023-09-20 06:36:43 +02:00
|
|
|
|
|
|
|
|
2022-06-25 14:24:14 +02:00
|
|
|
/*
|
2023-09-20 06:17:56 +02:00
|
|
|
* StoreRequest.php
|
|
|
|
* Copyright (c) 2023 james@firefly-iii.org
|
2022-06-25 14:24:14 +02:00
|
|
|
*
|
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-09-20 06:36:43 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2023-09-20 06:17:56 +02:00
|
|
|
namespace FireflyIII\Api\V2\Request\UserGroup;
|
2022-10-16 19:22:26 +02:00
|
|
|
|
2023-09-21 11:29:09 +02:00
|
|
|
use FireflyIII\Enums\UserRoleEnum;
|
2023-09-20 06:17:56 +02:00
|
|
|
use FireflyIII\Support\Request\ChecksLogin;
|
|
|
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
2022-06-25 14:24:14 +02:00
|
|
|
|
2023-09-20 06:36:43 +02:00
|
|
|
/**
|
|
|
|
* Class StoreRequest
|
|
|
|
*/
|
2023-09-20 06:17:56 +02:00
|
|
|
class StoreRequest extends FormRequest
|
2022-06-25 14:24:14 +02:00
|
|
|
{
|
2023-09-21 11:29:09 +02:00
|
|
|
protected array $acceptedRoles = [UserRoleEnum::OWNER, UserRoleEnum::FULL];
|
2023-09-20 06:17:56 +02:00
|
|
|
use ChecksLogin;
|
|
|
|
use ConvertsDataTypes;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getAll(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'title' => $this->convertString('title'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'title' => 'unique:user_groups,title|required|min:2|max:255',
|
|
|
|
];
|
|
|
|
}
|
2022-07-16 09:25:10 +02:00
|
|
|
}
|