Files
bogazici-api/app/Http/Requests/User/StoreUserRequest.php
2026-03-27 10:41:54 +03:00

44 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class StoreUserRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/**
* @return array<string, array<int, string>>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
'role' => ['required', 'string', 'exists:roles,name'],
];
}
/**
* @return array<string, string>
*/
public function messages(): array
{
return [
'name.required' => 'İsim alanı zorunludur.',
'email.required' => 'E-posta alanı zorunludur.',
'email.unique' => 'Bu e-posta adresi zaten kullanılıyor.',
'password.required' => 'Şifre alanı zorunludur.',
'password.min' => 'Şifre en az 8 karakter olmalıdır.',
'password.confirmed' => 'Şifre tekrarı eşleşmiyor.',
'role.required' => 'Rol alanı zorunludur.',
'role.exists' => 'Geçersiz rol.',
];
}
}