@@ -56,15 +56,10 @@ function cannot($ability, ...$arguments)
56
56
* @throws UnauthorizedPageException If the user is not authorized.
57
57
*/
58
58
if (! function_exists ('authorize ' )) {
59
- function authorize ($ ability , $ message = ' Unauthorized Action. ' , ...$ arguments ): bool
59
+ function authorize ($ ability , ...$ arguments ): bool
60
60
{
61
- if (! is_string ($ message )) {
62
- array_unshift ($ arguments , $ message );
63
- $ message = 'Unauthorized Action. ' ;
64
- }
65
-
66
61
if (cannot ($ ability , ...$ arguments )) {
67
- throw new UnauthorizedPageException ($ message );
62
+ throw new UnauthorizedPageException (' Unauthorized Action. ' );
68
63
}
69
64
70
65
return true ;
@@ -83,15 +78,10 @@ function authorize($ability, $message = 'Unauthorized Action.', ...$arguments):
83
78
* @throws PageNotFoundException If the user is not authorized.
84
79
*/
85
80
if (! function_exists ('authorizeOrNotFound ' )) {
86
- function authorizeOrNotFound ($ ability , $ message = ' Page Not Found. ' , ...$ arguments ): bool
81
+ function authorizeOrNotFound ($ ability , ...$ arguments ): bool
87
82
{
88
- if (! is_string ($ message )) {
89
- array_unshift ($ arguments , $ message );
90
- $ message = 'Page Not Found. ' ;
91
- }
92
-
93
83
if (cannot ($ ability , ...$ arguments )) {
94
- throw PageNotFoundException::forPageNotFound ($ message );
84
+ throw PageNotFoundException::forPageNotFound (' Page Not Found. ' );
95
85
}
96
86
97
87
return true ;
0 commit comments