diff --git a/app/Livewire/UserEdit.php b/app/Livewire/UserEdit.php index fd8fdff..d7d5603 100644 --- a/app/Livewire/UserEdit.php +++ b/app/Livewire/UserEdit.php @@ -21,7 +21,6 @@ class UserEdit extends Component protected $rules = [ 'name' => 'required|string|max:255', - 'email' => 'required|email|max:255|unique:users,email', 'phone' => 'nullable|string|max:15', 'location' => 'nullable|string|max:255', 'profile_photo' => 'nullable|image|max:1024', // Limit size to 1MB @@ -50,9 +49,7 @@ public function save(): Redirector | Redirect | RedirectResponse 'role' => $this->role, ]); - session()->flash('message', 'User profile updated successfully.'); - - return redirect()->route('users.show', $this->user->id); + return back()->with('message', 'User updated successfully'); } public function render(): View diff --git a/resources/views/livewire/user-edit.blade.php b/resources/views/livewire/user-edit.blade.php index 1f66f4b..93d98f7 100644 --- a/resources/views/livewire/user-edit.blade.php +++ b/resources/views/livewire/user-edit.blade.php @@ -1,3 +1,45 @@ -
- {{ --Todo edit all user data here --}} +
+ @if (session()->has('message')) + + @endif + +
+
+
+ + + @error('name') {{ $message }} @enderror +
+ +
+ + + @error('phone') {{ $message }} @enderror +
+ +
+ + + @error('location') {{ $message }} @enderror +
+ +
+ + + @error('role') {{ $message }} @enderror +
+
+ +
+ +
+