$ composer require scolib/laravel-action-log:1.3.*
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
$ composer require scolib/laravel-action-log:1.2.*
Add the ServiceProvider to the providers
array in config/app.php
\Sco\ActionLog\LaravelServiceProvider::class,
If you want to use the facade to logging actions, add this to the aliases
array in config/app.php
'ActionLog' => Sco\ActionLog\Facade::class,
Copy the package config to your local config with the publish command:
php artisan vendor:publish --provider="Sco\ActionLog\LaravelServiceProvider"
Default action log table name is action_logs
, If you want to customize it, edit the config/actionlog.php
Now run the artisan migrate command:
php artisan migrate
Override the property $events
in your Model
protected $events = [
'created' => \Sco\ActionLog\Events\ModelWasCreated::class,
];
⚠ Note: Laravel 5.5
Renamed$events
to$dispatchesEvents
(#17961, b6472bf, 3dbe12f)
All available event
[
'created' => \Sco\ActionLog\Events\ModelWasCreated::class,
'deleted' => \Sco\ActionLog\Events\ModelWasDeleted::class,
'restored' => \Sco\ActionLog\Events\ModelWasRestored::class,
'saved' => \Sco\ActionLog\Events\ModelWasSaved::class,
'updated' => \Sco\ActionLog\Events\ModelWasUpdated::class,
'creating' => \Sco\ActionLog\Events\ModelWillCreating::class,
'deleting' => \Sco\ActionLog\Events\ModelWillDeleting::class,
'restoring' => \Sco\ActionLog\Events\ModelWillRestoring::class,
'saving' => \Sco\ActionLog\Events\ModelWillSaving::class,
'updating' => \Sco\ActionLog\Events\ModelWillUpdating::class,
]
Manual logging actions
// use event
event(new \Sco\ActionLog\Events\ManualEvent($type, $content));
// use factory
\Sco\ActionLog\Factory::info(LogInfo $info);
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.