本文整理汇总了PHP中Illuminate\Support\Facades\Event::firing方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::firing方法的具体用法?PHP Event::firing怎么用?PHP Event::firing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Event
的用法示例。
在下文中一共展示了Event::firing方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerListeners
/**
*
*/
protected function registerListeners()
{
EventFacade::listen('*', function ($param) {
$this->data[] = ['name' => EventFacade::firing(), 'param' => $param, 'time' => microtime(true)];
$this->stream();
});
}
示例2: register
public function register()
{
foreach ($this->listening as $webookable) {
$this->app['events']->listen($webookable, function ($event) use($webookable) {
if (!Config::get("seeding")) {
$this->react(Event::firing(), $event);
}
});
}
}
示例3: registerEloquentEvents
protected function registerEloquentEvents()
{
// Flush Elegant cache when anything changes for models registered by Elegant
Event::listen('eloquent.*', function ($caller) {
$callerClass = get_class($caller);
if (!in_array($callerClass, ElegantConfig::getModelsAsClassNames())) {
return;
}
if (in_array(Event::firing(), ['eloquent.saved', 'eloquent.deleted', 'eloquent.updated', 'eloquent.created']) && $this->cacheIsTaggable()) {
Cache::tags('elegant-' . Support\ElegantModel::normalizeClassName($callerClass))->flush();
}
});
}
示例4: __construct
/**
* EventsDataSource constructor.
*/
public function __construct()
{
$this->events = [];
Event::listen('*', function ($param) {
/** @todo fix that shit */
if (!class_exists('events')) {
return;
}
$this->events[] = ['name' => Event::firing(), 'param' => json_encode($param), 'time' => microtime(true)];
$currentTime = microtime(true);
Clockwork::addEvent(uniqid('event_'), Event::firing(), $currentTime, $currentTime);
});
}
示例5: testRun
public function testRun()
{
$dsn = 'ipc://test-run.ipc';
if (!($pid = pcntl_fork())) {
$listener = new EventListener(['bind' => $dsn]);
Event::listen('request.event', function () use($listener) {
$listener->socket()->push(Event::firing(), func_get_args());
Event::fire('zeroevents.service.stop');
});
(new EventService())->listen($listener)->run();
exit;
}
$listener = new EventListener(['connect' => $dsn]);
Event::listen('request.event', $listener);
Event::fire('request.event', ['source', 'parent']);
$this->assertSame(['event' => 'request.event', 'payload' => ['source', 'parent'], 'address' => null], $listener->socket()->pull());
pcntl_wait($status);
posix_kill($pid, SIGKILL);
}
示例6: handleEvent
/**
* Event listener.
*
* @param $eventData
*/
public function handleEvent($eventData)
{
$eventName = Event::firing();
$webhooks = $this->getWebhooks()->where("event", $eventName);
$webhooks = $webhooks->filter($this->config->get("captain_hook.filter", null));
$this->callWebhooks($webhooks, $eventData);
}
示例7: handleEvent
/**
* Event listener.
*
* @param $eventData
*/
public function handleEvent($eventData)
{
$eventName = Event::firing();
$webhooks = $this->getWebhooks()->where('event', $eventName);
$webhooks = $webhooks->filter($this->config->get('captain_hook.filter', null));
if (!$webhooks->isEmpty()) {
$this->dispatch(new TriggerWebhooksJob($webhooks, $eventData));
}
}
示例8: testPullAndFire
public function testPullAndFire()
{
$dsn = 'ipc://test-pull-and-fire.ipc';
if (!($pid = pcntl_fork())) {
$socket = $this->socket();
$socket->bind($dsn);
$socket->push('response.event', [$socket->pull()]);
exit;
}
$socket = $this->socket();
$socket->connect($dsn)->push('request.event', ['source', 'parent']);
$event = null;
Event::listen('response.event', function () use(&$event) {
$event = ['event' => Event::firing(), 'payload' => func_get_args()];
return true;
});
$this->assertTrue($socket->pullAndFire());
$this->assertSame(['event' => 'response.event', 'payload' => [['event' => 'request.event', 'payload' => ['source', 'parent'], 'address' => null]]], $event);
posix_kill($pid, SIGKILL);
@unlink('test-pull-and-fire.ipc');
}
示例9: logEvent
/**
* Log Esensi events to the info log.
*
* @return void
*/
public function logEvent()
{
if (config('app.debug')) {
Log::info(Event::firing());
}
}
示例10: __invoke
/**
* Magic method for event dispatcher
*
* @return mixed
*/
public function __invoke()
{
return $this->socket()->push(Event::firing(), func_get_args());
}