The
event
function dispatches the given event to its listeners:<?php event(new UserRegistered($user));
<?php : $query->delete();
if ($count > 0) {
event(new ModelsPruned(static::class, $total));
}
} while ($count > 0);
<?php $total += $models->count();
event(new ModelsPruned(static::class, $total));
});
return $total;
<?php if (! $this->user()->hasVerifiedEmail()) {
$this->user()->markEmailAsVerified();
event(new Verified($this->user()));
}
}
<?php public static function dispatch()
{
return event(new static(...func_get_args()));
}
<?php public static function dispatchIf($boolean, ...$arguments)
{
if ($boolean) {
return event(new static(...$arguments));
}
}
<?php public static function dispatchUnless($boolean, ...$arguments)
{
if (! $boolean) {
return event(new static(...$arguments));
}
}
<?php public function pruneAll()
{
event(new ModelsPruned(static::class, 10));
event(new ModelsPruned(static::class, 20));
return 20;
<?php public function pruneAll()
{
event(new ModelsPruned(static::class, 10));
event(new ModelsPruned(static::class, 20));
return 20;
}
<?php Event::fake();
Model::handleLazyLoadingViolationUsing(function ($model, $key) {
event(new ViolatedLazyLoadingEvent($model, $key));
});
EloquentStrictLoadingTestModel1::create();