[ Mini Kiebo ]
Server: Windows NT AKFAR_SERVER 10.0 build 26200 (Windows 10) AMD64
Path:
D:
/
xampp
/
htdocs
/
surat
/
app
/
Http
/
Requests
/
[
Home
]
File: UpdateUserRequest.php
<?php namespace App\Http\Requests; use App\Enums\Role; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Rule; class UpdateUserRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize(): bool { return auth()->user()->role == Role::ADMIN->status() || $this->id == auth()->user()->id; } /** * @return array */ public function attributes(): array { return [ 'name' => __('model.user.name'), 'email' => __('model.user.email'), 'phone' => __('model.user.phone'), ]; } /** * Get the validation rules that apply to the request. * * @return array<string, mixed> */ public function rules(): array { return [ 'name' => ['required'], 'email' => ['required', Rule::unique('users')->ignore($this->id)], 'phone' => ['nullable'], 'is_active' => ['nullable'], ]; } }