komicho/laravel-model-activity

There is no license information available for the latest version (v1.0) of this package.

v1.0 2019-07-26 21:56 UTC

This package is auto-updated.

Last update: 2024-10-29 05:40:56 UTC


README

Create an activity log for each user.

Install via composer

$ composer require komicho/laravel-user-activity

Publish vendor

  • Run php artisan vendor:publish
  • Selection Komicho\Laravel\ModelActivity\ServiceProvider

Functions :-

Add Activity

use Komicho\Laravel\ModelActivity\Activity;
// add
Activity::add(<user_id>, <item_id>, '<definition_flag>');

Config file

Go to config/komicho/user_activity.php

  • You can set definitions:-
'definitions' => [
    '<definition_flag>' => '<definition_text>'
]

Use Trait in user model

use Komicho\Laravel\ModelActivity\Traits\ModelActivity;

class User extends Authenticatable
{
    use ModelActivity;
    ...

Get all activitys for user:-

Auth::user()->activitys;