/** * Store emails in the database. * * @param $emails * @return $this */ protected function storeEmails($emails) { if (count($emails) > 0) { foreach ($emails as $email) { if (!$this->isValidEmail($email)) { continue; } $this->search->resources()->firstOrCreate(['type' => $this->search->type, 'name' => $email, 'user_id' => $this->search->user_id]); } } return $this; }