1. Go to this page and download the library: Download jpkleemans/attribute-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/ */
jpkleemans / attribute-events example snippets
class Order extends Model
{
protected $dispatchesEvents = [
'status:shipped' => OrderShipped::class,
'note:*' => OrderNoteChanged::class,
];
}
class Order extends Model
{
use AttributeEvents;
protected $dispatchesEvents = [
'created' => OrderPlaced::class,
'status:canceled' => OrderCanceled::class,
'note:*' => OrderNoteChanged::class,
];
}