1. Go to this page and download the library: Download rembon/laravel-auditor library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rembon / laravel-auditor example snippets
'providers' => [
/*
* Laravel Framework Service Providers...
*/
...
/*
* Package Service Providers...
*/
\Rembon\LaravelAuditor\LaravelAuditorServiceProvider::class,
/*
* Application Service Providers...
*/
...
],
...
use Illuminate\Mail\Events\MessageSent;
use Illuminate\Notifications\Events\NotificationSent;
use Rembon\LaravelAuditor\Listeners\AuthorizeMail;
use Rembon\LaravelAuditor\Listeners\AuthorizeNotification;
Schema::create('audits', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable(); // modify this line into foreignUuid method, do not change the column name
$table->string('url');
$table->dateTime('datetime');
$table->double('request_time');
$table->string('route')->nullable();
$table->json('abilities')->nullable();
$table->json('emails')->nullable();
$table->json('models')->nullable();
$table->json('notifications')->nullable();
$table->json('properties')->nullable();
$table->timestamps();
});
use Rembon\LaravelAuditor\Traits\Auditable;
class User extends Authenticatable
{
use ..., Auditable;
...
}