abort
laravel/framework
The
abort
function throws
an HTTP exception
which will be rendered by the
exception handler
:
abort
(
403
);
(
$request
->
user
() instanceof
MustVerifyEmail
&&
!
$request
->
user
()->
hasVerifiedEmail
())) {
return
$request
->
expectsJson
()
?
abort
(
403
,
'Your email address is not verified.'
)
:
Redirect
::
guest
(
URL
::
route
(
$redirectToRoute
?:
'verification.notice'
));
}
src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php
function
abort_if
(
$boolean
,
$code
,
$message
=
''
, array
$headers
= [])
{
if (
$boolean
) {
abort
(
$code
,
$message
,
$headers
);
}
}
}
src/Illuminate/Foundation/helpers.php
function
abort_unless
(
$boolean
,
$code
,
$message
=
''
, array
$headers
= [])
{
if (!
$boolean
) {
abort
(
$code
,
$message
,
$headers
);
}
}
}
src/Illuminate/Foundation/helpers.php
$router
->
post
(
'api/error'
, [
'uses'
=> function () {
abort
(
500
);
},
]);
tests/Integration/Http/Middleware/HandleCorsTest.php