Skip to content

Commit

Permalink
include a documentation for customizing exception in laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
frankliniwobi committed Nov 27, 2024
1 parent 4981e71 commit d0b39ca
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/advanced-usage/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,18 @@ public function register()
});
}
```

**If you are running Laravel v11**
```php

// bootstrap/app.php

->withExceptions(function (Exceptions $exceptions) {
$exceptions->render(function (\Spatie\Permission\Exceptions\UnauthorizedException $e, $request) {
return response()->json([
'responseMessage' => 'You do not have the required authorization.',
'responseStatus' => 403,
]);
});
}
```

0 comments on commit d0b39ca

Please sign in to comment.