PHP code example of jarl / activity-log

1. Go to this page and download the library: Download jarl/activity-log 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/ */

    

jarl / activity-log example snippets


composer 

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-config"

use LogsActivityTrait;

use Jarl\ActivityLog\Http\Traits\LogsActivityTrait;
use Spatie\Activitylog\Models\Activity;
......

class User extends Model{
    ...
    use LogsActivityTrait;
    public function tapActivity(Activity $activity, string $eventName)
    {
        $activity->ip = request()->ip();
        $activity->causer_id = 2;
        //$activity->description = '你想要修改的description';
    }
}