PHP code example of ekoyanu99 / laravel-activitylog-ui

1. Go to this page and download the library: Download ekoyanu99/laravel-activitylog-ui 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/ */

    

ekoyanu99 / laravel-activitylog-ui example snippets


   use Spatie\Activitylog\Traits\LogsActivity;

   class YourModel extends Model {
       use LogsActivity;
   }
   

return [
    'route' => [
        'prefix' => 'activitylog-ui', // URL prefix
        'middleware' => null,         // Auto-detected or custom array
    ],

    'authorization' => [
        'enabled' => false,           // true => uses Gate / auth middleware
        'gate'    => 'viewActivityLogUi',
    ],

    'access' => [
        'allowed_users' => [],        // user email whitelist
        'allowed_roles' => [],        // role names (Spatie Permission, etc.)
    ],

    'features' => [
        'analytics'   => true,      // Show analytics dashboard tab
        'exports'     => true,      // Enable data exports
        'saved_views' => true,      // Allow saving filter configurations
    ],

    'exports' => [
        'enabled_formats' => ['csv', 'xlsx', 'pdf', 'json'],
        'max_records'     => 10000, // Max records per export (configurable via ACTIVITYLOG_MAX_EXPORT_RECORDS)
        'queue' => [
            'enabled'   => false,   // Queue exports >1000 records
            'threshold' => 1000,    // Records count threshold for queueing
            'queue_name'=> 'exports',
            'timeout'   => 300,     // 5 minutes
            'tries'     => 3,       // Retry failed exports 3 times
        ],
    ],
];
bash
   # Config file (config/activitylog-ui.php)
    php artisan vendor:publish --provider="ekoyanu99\ActivitylogUi\ActivitylogUiServiceProvider" --tag="activitylog-ui-config"

   # Blade views (if you want to customise)
    php artisan vendor:publish --provider="ekoyanu99\ActivitylogUi\ActivitylogUiServiceProvider" --tag="activitylog-ui-views"

   # Public assets (logo, js, css)
    php artisan vendor:publish --provider="ekoyanu99\ActivitylogUi\ActivitylogUiServiceProvider" --tag="activitylog-ui-assets"
   
bash
   php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"
   php artisan migrate