update deploy
This commit is contained in:
43
app/Http/Requests/User/StoreUserRequest.php
Normal file
43
app/Http/Requests/User/StoreUserRequest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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.',
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Http/Requests/User/UpdateUserRequest.php
Normal file
42
app/Http/Requests/User/UpdateUserRequest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\User;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateUserRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['sometimes', 'required', 'string', 'max:255'],
|
||||
'email' => ['sometimes', 'required', 'string', 'email', 'max:255', Rule::unique('users', 'email')->ignore($this->route('user'))],
|
||||
'password' => ['nullable', 'string', 'min:8', 'confirmed'],
|
||||
'role' => ['sometimes', '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.min' => 'Şifre en az 8 karakter olmalıdır.',
|
||||
'password.confirmed' => 'Şifre tekrarı eşleşmiyor.',
|
||||
'role.exists' => 'Geçersiz rol.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user