1. Go to this page and download the library: Download ctf0/odin 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/ */
use ctf0\Odin\Traits\Revisions;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Contracts\Auditable as AuditableContract;
class Post extends Model implements AuditableContract
{
use Revisions;
/**
* resolve model title/name for the revision relation
* this is needed so we can render
* the model relation attach/detach changes
*/
public function getMiscTitleAttribute()
{
return $this->name;
}
// ...
}
// app/Providers/EventServiceProvider
use OwenIt\Auditing\Models\Audit;
public function boot()
{
parent::boot();
Audit::creating(function (Audit $model) {
if (empty($model->old_values) && empty($model->new_values)) {
return false;
}
});
}
$model = Model::update([...]);
$model->touch();
bash
php artisan odin:gc
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.