inisiatif/laravel-event-history is a Laravel package for record event as history.
It currently has 0 GitHub stars and 9.462 downloads on Packagist (latest version 0.5.0).
Install it with composer require inisiatif/laravel-event-history.
Discover more Laravel packages by inisiatif
or browse all Laravel packages to compare alternatives.
Last updated
Paket ini digunakan untuk mencatan event seperti Pengajuan sudah di setujui dll.
You can install the package via composer:
composer require inisiatif/laravel-event-history
You can publish and run the migrations with:
php artisan vendor:publish --tag="event-history-migrations"
php artisan migrate
Melakukan registrasi user model, tambahkan code berikut di boot method AppServiceProvider
use Inisiatif\EventHistory\EventHistories;
EventHistories::useUserModelClassName(User::class);
Selanjutnya semua model yang mempunyai history harus implement interface Inisiatif\EventHistory\Concerns\HasEventHistories, kita juga
bisa menggunakan default implementasi dengan trait Inisiatif\EventHistory\InteractWithEventHistories
use Illuminate\Database\Eloquent\Model;
use Inisiatif\EventHistory\Concerns\HasEventHistories;
use Inisiatif\EventHistory\InteractWithEventHistories;
class ExampleModel extends Model implements HasEventHistories {
use InteractWithEventHistories;
}
Anda bisa menggukakan Inisiatif\EventHistory\RecordEventHistoryListener untuk setiap event yang akan di catat history-nya,
yang perlu di pastikan adalah event anda harus implements Inisiatif\EventHistory\Concerns\EventHistoryAwareInterface
<?php
declare(strict_types=1);
namespace Inisiatif\EventHistory\Concerns;
interface EventHistoryAwareInterface
{
public function getModelAwareHistories(): mixed;
public function getHistoryDescription(): string;
}
method getModelAwareHistories harus return model atau collection dengan interface Inisiatif\EventHistory\Concerns\HasEventHistories.
Under the hood, listener akan memanggil job Inisiatif\EventHistory\Jobs\NewEventHistoryJob
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.