Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Latest commit

 

History

History
75 lines (49 loc) · 1.91 KB

README.md

File metadata and controls

75 lines (49 loc) · 1.91 KB

Laravel Mention

❤️ This package helps you complete @ function

Latest Stable Version Latest Unstable Version Total Downloads License

Requirement

  • PHP >= 5.4.0

Installation

$ composer require dongm2ez/larvel-mention

After installing the library, register the Dongm2ez\Mention\MentionServiceProvider in your config/app.php file:

'providers' => [
    // Other service providers...
    Dongm2ez\Mention\MentionServiceProvider::class,
],

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

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

return [
   // They contain the model that will be mentioned
   'users' => [
       // Model that will be mentioned
       'model' => 'App\User',

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

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

   // laravel route alias
   'route_name' => 'users.show',

   // output format "html", "Markdown"
   'format' => 'html',

];

Usage

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

License

MIT