src/Parser/MentionParser.php
protected function mapper(string $key)
    {
        $character = $this->getOption('character');
        $config = config('mentions.pools.' . $this->getOption('pool'));

        $mention = str_replace($character, '', trim($key));

        $mentionned = $config['model']::whereRaw("LOWER({$config['column']}) = ?", [Str::lower($mention)])->first();

        if ($mentionned == false) {
            return null;
        }

        if ($this->getOption('mention') == true && $mentionned->getKey() !== Auth::id()) {
            $this->model->mention($mentionned, $this->getOption('notify'));
        }

        return '/' . preg_quote($key) . '(?!\w)/';
    }
protected function mapper(string $key)
    {
        $character = $this->getOption('character');
        $config = config('mentions.pools.' . $this->getOption('pool'));

        $mention = str_replace($character, '', trim($key));

        $mentionned = $config['model']::whereRaw("LOWER({$config['column']}) = ?", [Str::lower($mention)])->first();

        if ($mentionned == false) {
            return null;
        }

        if ($this->getOption('mention') == true && $mentionned->getKey() !== Auth::id()) {
            $this->model->mention($mentionned, $this->getOption('notify'));
        }

        return '/' . preg_quote($key) . '(?!\w)/';
    }
protected function mapper ( string $ key ) { $ character = $ this -> getOption ( 'character' ) ; $ config = config ( 'mentions.pools.' . $ this -> getOption ( 'pool' ) ) ; $ mention = str_replace ( $ character , '' , trim ( $ key ) ) ; $ mentionned = $ config [ 'model' ] :: whereRaw ( "LOWER({$config['column']}) = ?" , [ Str :: lower ( $ mention ) ] ) -> first ( ) ; if ( $ mentionned == false ) { return null ; } if ( $ this -> getOption ( 'mention' ) == true && $ mentionned -> getKey ( ) !== Auth :: id ( ) ) { $ this -> model -> mention ( $ mentionned , $ this -> getOption ( 'notify' ) ) ; } return '/' . preg_quote ( $ key ) . '(?!\w)/' ; }
Handle a mention and return it has a regex. If you want to delete
this mention from the out array, just return `null`.

@param string $key The mention that has been matched.

@return null|string
Handle a mention and return it has a regex . If you want to delete this mention from the out array just return null .