PHP code example of mdimannyit / changelog-tracker

1. Go to this page and download the library: Download mdimannyit/changelog-tracker 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/ */

    

mdimannyit / changelog-tracker example snippets


use MannyDesignedIt\ChangelogTracker\Facades\Changelog;

Changelog::record(
    title: 'Product inventory adjusted',
    raw_change: [
        'old_stock' => 10,
        'new_stock' => 45,
        'user' => auth()->user()?->name,
    ],
    source_type: 'App\\Models\\Product',
    actor_user_id: auth()->id(),
);

// config/changelog.php
return [
    'route_prefix' => 'admin/changelog',
    
    // Add your auth middleware here to secure the panel
    'middleware' => ['web', 'auth', 'can:view-changelog'],
    
    // ...
];
bash
php artisan vendor:publish --tag="changelog-config"
bash
php artisan changelog:sync-env --dry-run
php artisan changelog:sync-env
bash
php artisan migrate
bash
php artisan vendor:publish --tag=changelog-views