PHP code example of devel8 / laravel-action-tracker

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

    

devel8 / laravel-action-tracker example snippets

 php
'providers' => [
    ...
    Devel8\LaravelActionTracker\ActionTrackerProvider::class,
],

php artisan vendor:publish --provider "Devel8\LaravelActionTracker\ActionTrackerProvider"

php artisan migrate
 php
protected $actions = [
        'closed',
        'created'
    ];
 php
/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    \Devel8\LaravelActionTracker\ActionTracked::class => [
        \App\Listeners\YourListener::class,
    ],
];
 php
    /**
     * Action events list
     */
    protected array $actionEvents = [
        'closed' => \App\Events\PostClosed::class
    ];
 php
    class PostClosed
    {
    
        use SerializesModels;
    
        public ActionTracker $actionTracker;
    
        /**
         * ActionTracked constructor.
         *
         * @param ActionTracker $actionTracker
         */
        public function __construct(ActionTracker $actionTracker)
        {
            $this->actionTracker = $actionTracker;
        }
    
    }