2017 © Pedro Peláez
 

library laravel-activity

A simple activity feed package for Laravel 4.

image

dmyers/laravel-activity

A simple activity feed package for Laravel 4.

  • Monday, July 13, 2015
  • by adrianmejias
  • Repository
  • 1 Watchers
  • 5 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Activity Package for Laravel 4

Activity is a activity/news feed system for Laravel 4 applications., (*1)

Installation via Composer

Add this to you composer.json file, in the require object:, (*2)

"dmyers/laravel-activity": "dev-master"

After that, run composer install to install Activity., (*3)

Add the service provider to app/config/app.php, within the providers array., (*4)

'providers' => array(
    // ...
    'Dmyers\Activity\ActivityServiceProvider',
)

Add a class alias to app/config/app.php, within the aliases array., (*5)

'aliases' => array(
    // ...
    'Activity' => 'Dmyers\Activity\Activity',
)

Publish the package's model, migration, and view., (*6)

php artisan model:publish dmyers/laravel-activity
php artisan migration:publish dmyers/laravel-activity
php artisan view:publish dmyers/laravel-activity

Finally, add the trait to the models you want to track activity on., (*7)

use ActivityTrait;

protected $activity_item_field = 'id';

protected $activity_doer_field = 'user_id';

protected $activity_events = array('created', 'updated', 'deleted');

protected $activity_feed_type = 'user';

Usage

First get an instance of an item type (model):, (*8)

$object = Model::find(1);

Fetch all the activity:, (*9)

$object->activity(array(
    'id'        => $activity_id, // optional
    'doer_id'   => $doer_id, // optional
    'victim_id' => $victim_id, // optional
    'item_id'   => $item_id, // optional
    'item_type' => $item_type, // optional
    'feed_type' => $feed_type, // optional
));

Track an activity event:, (*10)

$object->addActivity($item_type, $doer_id, $victim_id, $action);

Update an activity event:, (*11)

$object->updateActivity($item_type, $doer_id, $victim_id, $action);

Delete an activity event:, (*12)

$object->deleteActivity($item_type, $doer_id, $victim_id, $action);

Display an activity feed:, (*13)

$object->renderActivityFeed($type, $doer_id, $victim_id);

Push a feed into another activity feed:, (*14)

$object->pushActivityFeed($type, $doer_id, $victim_id);

The Versions

13/07 2015

dev-master

9999999-dev

A simple activity feed package for Laravel 4.

  Sources   Download

MIT

The Requires

 

laravel newsfeed activity feed activity stream