event
laravel/framework
The
event
function dispatches the given
event
to its listeners:
event
(new
UserRegistered
(
$user
));
:
$query
->
delete
();
if (
$count
>
0
) {
event
(new
ModelsPruned
(static::class,
$total
));
}
} while (
$count
>
0
);
src/Illuminate/Database/Eloquent/MassPrunable.php
$total
+=
$models
->
count
();
event
(new
ModelsPruned
(static::class,
$total
));
});
return
$total
;
src/Illuminate/Database/Eloquent/Prunable.php
if (!
$this
->
user
()->
hasVerifiedEmail
()) {
$this
->
user
()->
markEmailAsVerified
();
event
(new
Verified
(
$this
->
user
()));
}
}
src/Illuminate/Foundation/Auth/EmailVerificationRequest.php
public static function
dispatch
()
{
return
event
(new static(...
func_get_args
()));
}
src/Illuminate/Foundation/Events/Dispatchable.php
public static function
dispatchIf
(
$boolean
, ...
$arguments
)
{
if (
$boolean
) {
return
event
(new static(...
$arguments
));
}
}
src/Illuminate/Foundation/Events/Dispatchable.php
public static function
dispatchUnless
(
$boolean
, ...
$arguments
)
{
if (!
$boolean
) {
return
event
(new static(...
$arguments
));
}
}
src/Illuminate/Foundation/Events/Dispatchable.php
public function
pruneAll
()
{
event
(new
ModelsPruned
(static::class,
10
));
event
(new
ModelsPruned
(static::class,
20
));
return
20
;
tests/Database/PruneCommandTest.php
public function
pruneAll
()
{
event
(new
ModelsPruned
(static::class,
10
));
event
(new
ModelsPruned
(static::class,
20
));
return
20
;
}
tests/Database/PruneCommandTest.php
Event
::
fake
();
Model
::
handleLazyLoadingViolationUsing
(function (
$model
,
$key
) {
event
(new
ViolatedLazyLoadingEvent
(
$model
,
$key
));
});
EloquentStrictLoadingTestModel1
::
create
();
tests/Integration/Database/EloquentStrictLoadingTest.php