Register all activities in your application's models.
Install through Composer
composer require marquine/activity-log
Add the ActivityLogServiceProvider to the providers array in the config/app.php file;
Marquine\ActivityLog\ActivityLogServiceProvider::class,
Publish the files:
php artisan vendor:publish --tag activity-log
The migration is not automatically loaded, so you can make changes like add constraints, change the table name, change id columns types, etc. Customize the migration if needed then migrate the table:
php artisan migrate
Create a model (if you choose a different name, make sure to change the model option in the config/activity.php file):
php artisan make:model Activity
Use the ActivityLog trait in the created model:
<?php
namespace App;
use Marquine\ActivityLog\ActivityLog;
use Illuminate\Database\Eloquent\Model;
class Activity extends Model
{
use ActivityLog;
}Use the Loggable trait in any model that you want to log its activities:
<?php
namespace App;
use Marquine\ActivityLog\Loggable;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use Loggable;
}Activity Log is licensed under the MIT license.