id); } public function creating(User $user) { // This is a hack for backward compatibility. if ($user->type == 0 && preg_match("#^fs.*@example\.org$#", $user->email) ) { $user->type = User::TYPE_ROBOT; } } /** * On user delete. * * @param User $user */ public function deleting(User $user) { $user->folders()->delete(); Follower::whereIn('user_id', $user->id)->delete(); } }