PHP code example of bhhaskin / laravel-audit

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

    

bhhaskin / laravel-audit example snippets


use Illuminate\Database\Eloquent\Model;
use LaravelAudit\Traits\Auditable;
use LaravelAudit\Traits\HasAuditUuid;

class Post extends Model
{
    use HasAuditUuid;
    use Auditable;
}

$post = Post::first();

foreach ($post->audits as $audit) {
    echo $audit->uuid; // Frontend-friendly identifier
}
bash
php artisan vendor:publish --provider="LaravelAudit\AuditServiceProvider" --tag=laravel-audit-config
php artisan vendor:publish --provider="LaravelAudit\AuditServiceProvider" --tag=laravel-audit-migrations
bash
php artisan migrate