PHP code example of nawasara / audit

1. Go to this page and download the library: Download nawasara/audit 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/ */

    

nawasara / audit example snippets


use Spatie\Activitylog\Traits\LogsActivity;
use Spatie\Activitylog\LogOptions;

class Post extends Model
{
    use LogsActivity;

    public function getActivitylogOptions(): LogOptions
    {
        return LogOptions::defaults()
            ->logOnly(['title', 'body'])
            ->logOnlyDirty();
    }
}
bash
composer migrate
php artisan db:seed --class="Nawasara\Audit\Database\Seeders\PermissionSeeder" --force