public function beforeDelete() { if ($this->info) { $this->info->delete(); } $sessions = Session::getList(['where' => ['user_id', $this->id]]); foreach ($sessions as $session) { $session->delete(); } foreach ($this->socials as $social) { $social->delete(); } }