PHP code example of hnhdigital-os / laravel-model-change-tracking

1. Go to this page and download the library: Download hnhdigital-os/laravel-model-change-tracking 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/ */

    

hnhdigital-os / laravel-model-change-tracking example snippets


    'providers' => [
        ...
        Bluora\LaravelModelChangeTracking\ServiceProvider::class,
        ...
    ];


namespace App\Models;

use Bluora\LaravelModelChangeTracking\ChangeByUserTrait;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use ChangeByUserTrait;
}

public function getCreatedByColumn()
{
    return false;
}

public function getUpdatedByColumn()
{
    return false;
}

public function getArchivedByColumn()
{
    return false;
}

public function getDeletedByColumn()
{
    return false;
}

public function getCreatedByColumn()
{
    return 'created_by';
}

public function getUpdatedByColumn()
{
    return 'updated_by';
}

public function getArchivedByColumn()
{
    return 'updated_by';
}

public function getDeletedByColumn()
{
    return 'deleted_by';
}


namespace App\Models;

use Bluora\LaravelModelChangeTracking\LogStateChangeTrait;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use LogStateChangeTrait;
}


namespace App\Models;

use Bluora\LaravelModelChangeTracking\LogChangeTrait;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use LogChangeTrait;

    protected $do_not_log = [
        'password',
        'remember_token',
    ];
}