/**
  * send forget mail to user
  *
  * @param array $parameters
  * @param string $column
  * @return mixed
  * @throws OAuthException
  * @throws QueryException
  */
 protected function sendForgetMail(array $parameters = [], $column = null)
 {
     $username = isset($parameters['username']) ? $parameters['username'] : '';
     $mailDriver = isset($parameters['mail_driver']) ? $parameters['mail_driver'] : 'default';
     $callback = isset($parameters['callback']) ? $parameters['callback'] : 'auth/forget';
     $table = Config::get('database.tables.table');
     $database = Database::table($table);
     $userColumn = null === $column ? first(Config::get('database.tables.login')) : $column;
     $userInformation = $database->select(['email', 'id'])->where($userColumn, $username);
     if (!$userInformation->rowCount()) {
         throw new OAuthException(sprintf('%s Username is not exists', $username));
     }
     $datas = $userInformation->first();
     // we will find user email now
     $mailAddress = $datas->email;
     $generator = new SecurityKeyGenerator();
     $key = $generator->random($username . $mailAddress);
     $forgets = Database::table('forgets');
     $add = $forgets->insert(['key' => $key, 'user_id' => $datas->id]);
     if (!$add->isSuccess()) {
         throw new QueryException('Forget keys and user_id could not added to database, please try agein later');
     }
     $url = Request::getBaseWithoutQuery();
     if (!Str::endsWith($callback, "/")) {
         $callback .= "/";
     }
     $url .= $callback . $key;
     $template = new TemplateGenerator(file_get_contents(RESOURCE . 'migrations/forget_mail.php.dist'));
     $content = $template->generate(['url' => $url, 'username' => $username]);
     $yourAddress = config('mail.your_address');
     $send = Mail::send($mailDriver, function (DriverInterface $mail) use($mailAddress, $username, $content, $yourAddress) {
         return $mail->from($yourAddress, '')->subject('Password Recovery')->to($mailAddress, $username)->body($content)->send();
     });
     return $send;
 }