Files
ots/app/Http/Requests/UpdateTeamRequest.php
T
Twyco 6220a26852
CI/CD / test_and_check_app (push) Failing after 2m15s
CI/CD / Publish immutable image (push) Skipped
added teams
2026-09-11 02:28:44 +02:00

32 lines
813 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
class UpdateTeamRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['nullable', 'string', 'max:255'],
'slug' => ['nullable', 'required_if:name', 'string', 'max:255', 'unique:teams,slug,'.$this->route('team')->id],
'require_2fa' => ['required', 'boolean'],
];
}
protected function prepareForValidation(): void
{
$this->merge([
'slug' => Str::slug($this->name),
]);
}
}