2017 © Pedro Peláez
 

library laravel-flaggable

Trait for Laravel Eloquent models to allow easy implementation of a 'flag' feature.

image

batuhan/laravel-flaggable

Trait for Laravel Eloquent models to allow easy implementation of a 'flag' feature.

  • Friday, April 24, 2015
  • by batuhan
  • Repository
  • 2 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 32 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Laravel Flaggable Plugin

Build Status Latest Stable Version License, (*1)

Trait for Laravel Eloquent models to allow easy implementation of a "flag" feature. Only tested with Laravel 5., (*2)

Composer Install (for Laravel 5)

composer require batuhan/laravel-flagable "~1.0.0"

Install and then run the migrations

'providers' => array(
    'Conner\Likeable\LikeableServiceProvider',
);
php artisan vendor:publish --provider="Conner\Likeable\LikeableServiceProvider"
php artisan migrate

Setup your models

class Article extends \Illuminate\Database\Eloquent\Model {
    use Conner\Likeable\LikeableTrait;
}

Sample Usage

$article->flag(); // like the article for current user
$article->flag($myUserId); // pass in your own user id
$article->flag(0); // just add flags to the count, and don't track by user

$article->unflag(); // remove flag from the article
$article->unflag($myUserId); // pass in your own user id
$article->unflag(0); // remove flags from the count -- does not check for user

$article->flagCount; // get count of flags

$article->flags; // Iterable Illuminate\Database\Eloquent\Collection of existing flags 

$article->flaged(); // check if currently logged in user flaged the article
$article->flaged($myUserId);

Article::whereflaged($myUserId) // find only articles where user flaged them
    ->with('flagCounter') // highly suggested to allow eager load
    ->get();

Credits

  • Robert Conner - http://smartersoftware.net

The Versions

24/04 2015

dev-master

9999999-dev https://smartersoftware.net/packages/laravel-likeable-favorite

Trait for Laravel Eloquent models to allow easy implementation of a 'flag' feature.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Batuhan Icoz

laravel eloquent trait remember flag like follow favorite likeable likable favourite

24/04 2015

1.0.0

1.0.0.0 https://smartersoftware.net/packages/laravel-likeable-favorite

Trait for Laravel Eloquent models to allow easy implementation of a 'flag' feature.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Batuhan Icoz

laravel eloquent trait remember flag like follow favorite likeable likable favourite