PHP code example of inisiatif / laravel-event-history

1. Go to this page and download the library: Download inisiatif/laravel-event-history 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/ */

    

inisiatif / laravel-event-history example snippets


use Inisiatif\EventHistory\EventHistories;

EventHistories::useUserModelClassName(User::class);

use Illuminate\Database\Eloquent\Model;
use Inisiatif\EventHistory\Concerns\HasEventHistories;
use Inisiatif\EventHistory\InteractWithEventHistories;

class ExampleModel extends Model implements HasEventHistories {
    use InteractWithEventHistories;
}



declare(strict_types=1);

namespace Inisiatif\EventHistory\Concerns;

interface EventHistoryAwareInterface
{
    public function getModelAwareHistories(): mixed;

    public function getHistoryDescription(): string;
}
bash
php artisan vendor:publish --tag="event-history-migrations"
php artisan migrate