Skip to content

Commit 406cd4e

Browse files
committed
Fixed user deletion to also delete associated links
#576
1 parent ccf5e7a commit 406cd4e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/Http/Controllers/AdminController.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,15 @@ public function deleteUser(request $request)
211211
{
212212
$id = $request->id;
213213

214-
$user = User::find($id);
215-
214+
Link::where('user_id', $id)->delete();
215+
216216
Schema::disableForeignKeyConstraints();
217+
218+
$user = User::find($id);
217219
$user->forceDelete();
220+
218221
Schema::enableForeignKeyConstraints();
219-
222+
220223
return redirect('admin/users/all');
221224
}
222225

0 commit comments

Comments
 (0)