2017 © Pedro Peláez
 

library laravel-mentions

Laravel 5 package that provides facebook-like mention functionality

image

unicodeveloper/laravel-mentions

Laravel 5 package that provides facebook-like mention functionality

  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 3 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

laravel-mentions

Latest Stable Version License Build Status Quality Score Total Downloads, (*1)

This package makes it possible to create text/textarea fields that enable mentioning by using At.js., (*2)

The data for the autocomplete is loaded from a route which will load data based on predefined key-value pairs of an alias and a model in the config., (*3)

Installation

First, pull in the package through Composer., (*4)

"require": {
    "unicodeveloper/laravel-mentions": "1.1.*"
}

And then include these service providers within config/app.php., (*5)

'providers' => [
    Unicodeveloper\Mention\MentionServiceProvider::class,
    Collective\Html\HtmlServiceProvider::class,
];

If you need to modify the configuration or the views, you can run:, (*6)

php artisan vendor:publish

The package views will now be located in the app/resources/views/vendor/mentions/ directory and the configuration will be located at config/mentions.php., (*7)

Configuration

To make it possible for At.js to load data we need to define key-value pairs that consist of an alias and a corresponding model., (*8)

return [

    'users'    => 'App\User',      // responds to /api/mentions/users
    'friends'  => 'App\Friend',    // responds to /api/mentions/friends
    'clients'  => 'App\Client',    // responds to /api/mentions/clients
    'supports' => 'App\Supporter', // responds to /api/mentions/supports

];

So now with these aliases configured we could create a new textfield which will send a request to the users route and search for matching data in the name column., (*9)

{!! mention()->asText('recipient', old('recipient'), 'users', 'name') !!}

You can also add a class name for styling of the text and textareas, that's the last argument. In this example, it is user-form, (*10)

{!! mention()->asText('recipient', old('recipient'), 'users', 'name', 'user-form') !!}

Example

<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Laravel PHP Framework</title>
        <link rel="stylesheet" type="text/css" href="/css/jquery.atwho.min.css">
         <!-- Requirements -->
        <script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
        <script src="/js/jquery.atwho.min.js"></script>
        <script src="/js/jquery.caret.min.js"></script>
        <!-- Laravel Mentions -->
        @include('mentions::assets')
    </head>

    <body>
        <div class="container">
            {!! mention()->asText('recipient', old('recipient'), 'users', 'name') !!}
            {!! mention()->asTextArea('message', old('message'), 'users', 'name') !!}
        </div><!-- /.container -->
    </body>
</html>

Install

Via Composer, (*11)

``` bash $ composer require unicodeveloper/laravel-mentions, (*12)


## Change log Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. ## Testing ``` bash $ composer test

Contributing

Please see CONTRIBUTING for details., (*13)

How can I thank you?

Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or HackerNews? Spread the word!, (*14)

Don't forget to follow me on twitter!, (*15)

Thanks! Prosper Otemuyiwa., (*16)

License

The MIT License (MIT). Please see License File for more information., (*17)

The Versions

25/02 2016

dev-master

9999999-dev https://github.com/unicodeveloper/laravel-mentions

Laravel 5 package that provides facebook-like mention functionality

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel autocomplete laravel 5 laravel-mentions facebook-mentions smart search

25/02 2016

1.1.1

1.1.1.0 https://github.com/unicodeveloper/laravel-mentions

Laravel 5 package that provides facebook-like mention functionality

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel autocomplete laravel 5 laravel-mentions facebook-mentions smart search

04/11 2015

1.1.0

1.1.0.0 https://github.com/unicodeveloper/laravel-mentions

Laravel 5 package that provides facebook-like mention functionality

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel autocomplete laravel 5 laravel-mentions facebook-mentions smart search

19/09 2015

1.0.0

1.0.0.0 https://github.com/busayo/laravel-mentions

Laravel 5 package that provides facebook-like mention functionality

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel autocomplete laravel-mentions facebook-mentions smart search

19/09 2015

0.1-alpha

0.1.0.0-alpha https://github.com/busayo/laravel-mentions

Laravel 5 package that provides facebook-like mention functionality

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel autocomplete laravel-mentions facebook-mentions smart search