rockbuzz/lara-activities

Lara Activities is a package that monitors activities for creating, editing, and deleting features, including manipulations of related tables.

3.1.1 2022-08-12 17:54 UTC

README

Lara Activities is a Laravel package that monitors activities for creating, editing, and deleting features, including manipulations of related tables.

Requirements

PHP: >=7.3

Install

$ composer require rockbuzz/lara-activities
$ php artisan vendor:publish --provider="Rockbuzz\LaraActivities\ServiceProvider" --tag=migrations
$ php artisan migrate

Usage

namespace App;

use Illuminate\Database\Eloquent\Model;
use Rockbuzz\LaraActivities\Traits\RecordsActivity;

class Post extends Model
{
    use RecordsActivity;

    //optional define activity table
    //public function __construct(array $attributes = [])
    //{
    //    parent::__construct($attributes);
    //
    //    $this->activityTable = 'post_activities';
    //}
}

Configuration

$ php artisan vendor:publish --provider="Rockbuzz\LaraActivities\ServiceProvider" --tag=config

You can define the layout of the views

'views' => [
    'layout' => 'layouts.admin'
]

You can override routes, controllers and middleware

'routes' => [
    'index' => [
        'uri' => 'admin/activities',
        'as' => 'admin.activities',
        'middleware' => ['web', 'auth'],
        'uses' => 'Rockbuzz\LaraActivities\Controllers\ActivitiesController@index'
    ]
]

You can define which models will be searched in the activity table

'subjects_class' => [
    'App\Post', 'App\Comment'
],

You can also customize the views

$ php artisan vendor:publish --provider="Rockbuzz\LaraActivities\ServiceProvider" --tag=views

You can also customize the lang

$ php artisan vendor:publish --provider="Rockbuzz\LaraActivities\ServiceProvider" --tag=lang

License

The Lara Activities is open-sourced software licensed under the MIT license.