PHP code example of insenseanalytics / laravel-user-audit-trails

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

    

insenseanalytics / laravel-user-audit-trails example snippets


$table->usertrails(); // for created_by, updated_by
$table->deletetrails(); // for deleted_by

class Post extends \Illuminate\Database\Eloquent\Model
{
    use \Insense\LaravelUserAuditTrails\HasUserTrails;
    use \Insense\LaravelUserAuditTrails\HasDeleteTrails;
}

'providers' => [
    ...,
    Insense\LaravelUserAuditTrails\UserTrailsServiceProvider::class,
]

$table->usertrails('your-created-by-column', 'your-updated-by-column');
$table->deletetrails('your-deleted-by-column');

class BaseModel extends \Illuminate\Database\Eloquent\Model
{
    use \Insense\LaravelUserAuditTrails\HasUserTrails;
    use \Insense\LaravelUserAuditTrails\HasDeleteTrails;
}

class YourModel extends BaseModel
{
    public static $CREATED_BY = 'your-created-by-column';
    public static $UPDATED_BY = 'your-updated-by-column';
    public static $DELETED_BY = 'your-deleted-by-column';
}

$table->usertrails('created_by', null);

class YourModel extends BaseModel
{
    public static $CREATED_BY = 'created_by';
    public static $UPDATED_BY = null;
}