PHP code example of reshadman / laravel-committed

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

    

reshadman / laravel-committed example snippets




return [
    // other stuff...
    'providers' => [
        // Other providers...
        \Reshadman\Committed\CommittedServiceProvider::class    
    ]  
];



use Reshadman\Committed\UnderstandsCommit;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use UnderstandsCommit;
    
    protected static function boot()
    {
        static::committed(function (User $user) {
            
            \Log::info($user->getKey()); 
        
        });
        
        static::committedCreation(function ($user) {});
        
        static::committedUpdate(function ($user) {});
        
        static::committedDelete(function () {});
        
        parent::boot();
    }
}