Skip to content

Commit 3444292

Browse files
committed
Add note regarding return value of authorize method
Note kind of shows differences between policy method authorize (exception is thrown), and request authorize (only response is returned).
1 parent 65a61d0 commit 3444292

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

validation.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ Since all form requests extend the base Laravel request class, we may use the `u
247247

248248
Route::post('comment/{comment}');
249249

250-
If the `authorize` method returns `false`, a HTTP response with a 403 status code will automatically be returned and your controller method will not execute.
250+
If the `authorize` method returns `false`, a HTTP response with a 403 status code will automatically be returned and your controller method will not execute.
251+
252+
> {note} Method `authorize` returns response object (`\Symfony\Component\HttpFoundation\Response`) and does not throw `\Symfony\Component\HttpKernel\Exception\HttpException`, therefore [custom HTTP error page](/docs/{{version}}/errors#custom-http-error-pages) will not be displayed.
251253
252254
If you plan to have authorization logic in another part of your application, simply return `true` from the `authorize` method:
253255

0 commit comments

Comments
 (0)