2017 © Pedro Peláez
 

library eloquent-sentiment

An eloquent package for adding sentiment to eloquent models.

image

mintbridge/eloquent-sentiment

An eloquent package for adding sentiment to eloquent models.

  • Sunday, February 21, 2016
  • by mintbridge
  • Repository
  • 1 Watchers
  • 1 Stars
  • 246 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Eloquent Sentiment

Laravel 5 package for adding sentiment to eloquent models., (*1)

Installation

This package can be installed through Composer., (*2)

composer require mintbridge/eloquent-sentiment

Once installed add the service provider and facade to your app config, (*3)

// config/app.php

'providers' => [
    '...',
    'Mintbridge\EloquentSentiment\SentimentServiceProvider',
];

'aliases' => [
    '...',
    'Sentiment' => 'Mintbridge\EloquentSentiment\SentimentFacade',
];

You'll also need to publish and run the migration in order to create the database table., (*4)

php artisan vendor:publish --provider="Mintbridge\EloquentSentiment\SentimentServiceProvider" --tag="config"
php artisan vendor:publish --provider="Mintbridge\EloquentSentiment\SentimentServiceProvider" --tag="migrations"
php artisan migrate

The configuration will be written to config/eloquent-sentiment.php. The options have sensible defaults but you should change the user model to match the one used in your application., (*5)

Usage

This package will allow your users to add sentiment to models used in your application. To do so the models that you would like to be sentimentable must use the Sentimentable trait and implement SentimentableInterface., (*6)

use Mintbridge\EloquentSentiment\Sentimentable;
use Mintbridge\EloquentSentiment\SentimentableInterface;

class Article extends Eloquent implements SentimentableInterface {

    use Sentimentable;
    ...
}

Sentiment can be added to models by using the SentimentManager or more easily with the Sentiment facade:, (*7)

$article = Article::find(1);

// add article as a favourite
Sentiment::add('like', $article);

// remove article from by a favourite
Sentiment::remove('like', $article);

// toggle article as being a favourite
Sentiment::toggle('like', $article);

Contributing

Please see CONTRIBUTING for details., (*8)

License

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

The Versions

21/02 2016

dev-master

9999999-dev

An eloquent package for adding sentiment to eloquent models.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent sentiment emoticon

21/02 2016

0.0.1

0.0.1.0

An eloquent package for adding sentiment to eloquent models.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel eloquent sentiment emoticon