1. Go to this page and download the library: Download asif/laravel-model-logs 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/ */
asif / laravel-model-logs example snippets
use Asif\LaravelModelLogs\Traits\LogChanges;
use Illuminate\Database\Eloquent\Model;
class YourModel extends Model
{
use LogChanges;
// Rest of your model code...
}
use Asif\LaravelModelLogs\Traits\LogChanges;
use Illuminate\Database\Eloquent\Model;
class YourModel extends Model
{
use LogChanges;
/**
* Customize the tracked events for this model.
*
* @var array<string>
*/
protected $trackedEvents = ['created', 'updated'];
// Rest of your model code...
}
use Asif\LaravelModelLogs\Traits\LogChanges;
use Illuminate\Database\Eloquent\Model;
class YourModel extends Model
{
use LogChanges;
/**
* The attributes that should be logged in the audit log.
*
* @var array<string>
*/
protected $loggable = ['name', 'email'];
// Rest of your model code...
}
bash
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.