mirror of
https://github.com/proelements/proelements.git
synced 2026-04-18 01:52:20 +00:00
v3.33.1
This commit is contained in:
30
core/notifications/traits/notifiable.php
Normal file
30
core/notifications/traits/notifiable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Core\Notifications\Traits;
|
||||
|
||||
use ElementorPro\Core\Notifications\Notification;
|
||||
use ElementorPro\Plugin;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
trait Notifiable {
|
||||
|
||||
/**
|
||||
* Notify a Model with a notification.
|
||||
* Syntactic sugar for sending notifications via the `Notifications_Manager`.
|
||||
*
|
||||
* Usage:
|
||||
* $model->notify( new User_Created_Notification( $new_user ) );
|
||||
*
|
||||
* @param Notification $notification - Notification to send.
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function notify( Notification $notification ) {
|
||||
Plugin::instance()->notifications->send( $notification, $this );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user