PHP code example of eribloo / laravel-model-snapshots

1. Go to this page and download the library: Download eribloo/laravel-model-snapshots 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/ */

    

eribloo / laravel-model-snapshots example snippets


return [

    /**
     * Snapshot class used. Must implement EriBloo\LaravelModelSnapshots\Contracts\Snapshot interface.
     */
    'snapshot_class' => EriBloo\LaravelModelSnapshots\Models\Snapshot::class,

    /**
     * Versionist class used. Must implement EriBloo\LaravelModelSnapshots\Contracts\Versionist interface.
     */
    'versionist_class' => EriBloo\LaravelModelSnapshots\Support\Versionists\IncrementingVersionist::class,

];

snapshot(Document::find(1))->commit();

public function getSnapshotOptions(): SnapshotOptions
{
    return SnapshotOptions::defaults();
}

public function getFirstVersion(): string;

public function getNextVersion(string $version): string;
bash
php artisan vendor:publish --tag="model-snapshots-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="model-snapshots-config"