1. Go to this page and download the library: Download webqamdev/activity-logger 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 Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Models\Concerns\LogsActivity;
use Spatie\Activitylog\Support\LogOptions;
class User extends Model
{
use LogsActivity;
public bool $enableLoggingModelsEvents = false;
/**
* Configure the activity logging rules.
*/
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->logAll() // Log all attributes...
->logOnlyDirty(); // ...but only store changes
}
}
class User extends Model {
/**
* The attributes that shouldn't be logged in activity logger.
*
* @var array
*/
public $logAttributesToIgnore = [
'password',
'phone',
];
...
}