Skip to content

Commit 480c553

Browse files
authored
authorize method may be removed if not used (#9130)
both removing the `authorize()` method, and returning `true` will result in the same behavior, so adding a comment to explain this is an option. https://github.com/laravel/framework/blob/10.x/src/Illuminate/Foundation/Http/FormRequest.php#L190 I would even go so far as to say we should *recommend* removing the method, as it's less code to run through, but this is probably good enough to start.
1 parent ee7b1a8 commit 480c553

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ Therefore, if your application is taking advantage of [route model binding](/doc
458458

459459
If the `authorize` method returns `false`, an HTTP response with a 403 status code will automatically be returned and your controller method will not execute.
460460

461-
If you plan to handle authorization logic for the request in another part of your application, you may simply return `true` from the `authorize` method:
461+
If you plan to handle authorization logic for the request in another part of your application, you may remove the `authorize` method completely, or simply return `true`:
462462

463463
/**
464464
* Determine if the user is authorized to make this request.

0 commit comments

Comments
 (0)