Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.
/ laravel-mention Public archive

[Deprecated] use XetaIO/Xetaravel-Mentions instead

License

Notifications You must be signed in to change notification settings

labs7in0/laravel-mention

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Mention

A package to parse @mentions from a text and mention the user with a notification.

Special thanks to David Dong and his laravel-mention, and Xetaravel-Mentions from XetaIO.

Requirement

  • PHP >= 5.6.0
  • Laravel 5.x

Installation

$ composer require labs7in0/larvel-mention

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

For Laravel < 5.5

After installing the library, register the Service Provider in your config/app.php file:

'providers' => [
    // ...
    Labs7in0\Mention\ServiceProvider::class,
    // ...
],

And the Facade:

'aliases' => [
    // ...
    'Mention' => Labs7in0\Mention\Facade::class,
    // ...
],

Configuration

As optional if you want to modify the default configuration, you can publish the configuration file:

$ php artisan vendor:publish --provider='Labs7in0\Mention\ServiceProvider' --tag="config"
<?php

return [
    // Model that will be mentioned.
    'model' => App\User::class,

    // The column that will be used to search the model by the parser.
    'column' => 'name',

    // Match the front mentioned info
    'regex' => '/(\S*)\@([^\r\n\s]*)/i',

    // The route used to generate the user link.
    'route' => 'profile',

    // Output format, can be "html" or "markdown".
    'format' => 'markdown',

    // Notification class to use when the model is mentioned.
    // Leave null to disable notification.
    'notification' => App\Notifications\MentionNotification::class,
];

Usage

$parseText = Mention::parse("@david @Aaron @Judy @麦索 Balabalabala...");

License

The MIT License

More info see LICENSE

About

[Deprecated] use XetaIO/Xetaravel-Mentions instead

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages