2018-01-12 20:39:15 -06:00
|
|
|
<?php
|
|
|
|
|
|
2024-03-12 22:39:16 -04:00
|
|
|
namespace App\Http\Requests\Api\Application\Users;
|
2018-01-12 20:39:15 -06:00
|
|
|
|
2025-09-24 13:34:19 +02:00
|
|
|
use App\Http\Requests\Api\Application\ApplicationApiRequest;
|
2024-03-12 22:39:16 -04:00
|
|
|
use App\Models\User;
|
|
|
|
|
use App\Services\Acl\Api\AdminAcl;
|
2018-01-12 20:39:15 -06:00
|
|
|
|
2018-01-19 21:47:06 -06:00
|
|
|
class StoreUserRequest extends ApplicationApiRequest
|
2018-01-12 20:39:15 -06:00
|
|
|
{
|
2024-11-06 09:09:10 +01:00
|
|
|
protected ?string $resource = User::RESOURCE_NAME;
|
2018-01-12 20:39:15 -06:00
|
|
|
|
2022-10-14 10:59:20 -06:00
|
|
|
protected int $permission = AdminAcl::WRITE;
|
2018-01-12 20:39:15 -06:00
|
|
|
|
|
|
|
|
/**
|
2025-03-03 14:41:19 -05:00
|
|
|
* @param array<array-key, string|string[]> |null $rules
|
|
|
|
|
* @return array<array-key, string|string[]>
|
2018-01-12 20:39:15 -06:00
|
|
|
*/
|
2024-10-19 18:41:08 -04:00
|
|
|
public function rules(?array $rules = null): array
|
2018-01-12 20:39:15 -06:00
|
|
|
{
|
2019-09-04 22:26:28 -07:00
|
|
|
$rules = $rules ?? User::getRules();
|
2018-02-04 15:38:38 -06:00
|
|
|
|
2025-01-03 17:13:44 -05:00
|
|
|
return collect($rules)->only([
|
2018-01-12 20:39:15 -06:00
|
|
|
'external_id',
|
2025-12-17 20:09:17 +01:00
|
|
|
'is_managed_externally',
|
2018-01-12 20:39:15 -06:00
|
|
|
'email',
|
|
|
|
|
'username',
|
|
|
|
|
'password',
|
|
|
|
|
'language',
|
2024-06-29 23:42:46 +02:00
|
|
|
'timezone',
|
2018-01-12 20:39:15 -06:00
|
|
|
])->toArray();
|
2018-02-04 15:38:38 -06:00
|
|
|
}
|
|
|
|
|
|
2018-01-12 20:39:15 -06:00
|
|
|
/**
|
2025-03-03 14:41:19 -05:00
|
|
|
* Rename some fields to be more user-friendly.
|
|
|
|
|
*
|
|
|
|
|
* @return array<array-key, string>
|
2018-01-12 20:39:15 -06:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function attributes(): array
|
2018-01-12 20:39:15 -06:00
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'external_id' => 'Third Party Identifier',
|
2025-12-17 20:09:17 +01:00
|
|
|
'is_managed_externally' => 'Is managed by Third Party?',
|
2018-01-12 20:39:15 -06:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|