承接 mintbridge/eloquent-sentiment 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mintbridge/eloquent-sentiment

Composer 安装命令:

composer require mintbridge/eloquent-sentiment

包简介

An eloquent package for adding sentiment to eloquent models.

README 文档

README

Laravel 5 package for adding sentiment to eloquent models.

Installation

This package can be installed through Composer.

composer require mintbridge/eloquent-sentiment

Once installed add the service provider and facade to your app config

// 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.

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.

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.

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:

$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.

License

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

统计信息

  • 总下载量: 256
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固