Skip to content

Commit

Permalink
Delete records from followers table when the user is deleted from DB
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Feb 15, 2023
1 parent 7875faa commit 4eadecc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/Observers/UserObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Observers;

use App\Follower;
use App\Mailbox;
use App\Subscription;
use App\User;
Expand Down Expand Up @@ -40,5 +41,6 @@ public function creating(User $user)
public function deleting(User $user)
{
$user->folders()->delete();
Follower::whereIn('user_id', $user->id)->delete();
}
}

0 comments on commit 4eadecc

Please sign in to comment.