Skip to content

Commit

Permalink
Support UserSaving
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Nov 21, 2023
1 parent 1aa8eba commit 5311117
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions resources/js/components/users/PublishForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ export default {
this.$axios[this.method](this.actions.save, this.visibleValues).then(response => {
this.title = response.data.title;
if (!response.data.saved) {
return this.$toast.error(`Couldn't save user`)
}
if (!this.isCreating) this.$toast.success(__('Saved'));
this.$refs.container.saved();
this.$nextTick(() => this.$emit('saved', response));
Expand Down
7 changes: 5 additions & 2 deletions src/Http/Controllers/CP/Users/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,12 @@ public function update(Request $request, $user)
$user->groups($request->groups);
}

$user->save();
$save = $user->save();

return ['title' => $user->title()];
return [
'title' => $user->title(),
'saved' => is_bool($save) ? $save : true,
];
}

public function destroy($user)
Expand Down

0 comments on commit 5311117

Please sign in to comment.