PHP code example of elegantweb / laravel-transactional-events

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

    

elegantweb / laravel-transactional-events example snippets


return [
    'Events',
    ],
];

return [
    'Events',
    ],

    'exclude' => [
        'App\Events\MyAwesomeEvent',
    ],
];
 php
DB::transaction(function () {
    $post = Post::create(['title' => 'An Awesome Post!']);
    event(new PostCreated($post));
    $post->categories()->create(['name' => 'Blog']);
});
 php
use Elegant\Events\TransactionalEvent;

class MyAwesomeEvent implements TransactionalEvent
{
}
 bash
php artisan vendor:publish --tag="laravel-transactional-events-config"