We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3ff21f2 commit 7798dddCopy full SHA for 7798ddd
README.md
@@ -124,6 +124,28 @@ results in:
124
}
125
```
126
127
+## Use with the Exception Handler
128
+
129
+```php
130
+namespace App\Exceptions;
131
132
+use ApiSkeletons\Laravel\ApiProblem\Facades\ApiProblem;
133
+use Doctrine\ORM\EntityNotFoundException;
134
+use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
135
+use Illuminate\Http\Request;
136
137
+class Handler extends ExceptionHandler
138
+{
139
+ public function register(): void
140
+ {
141
+ $this->renderable(function (EntityNotFoundException $e, Request $request) {
142
+ return ApiProblem::response($e->getMessage(), 404);
143
+ });
144
+ }
145
+}
146
147
+```
148
149
## Attribution
150
151
The bulk of this repository was copied from Laminas API Tools. I wanted to provide a
0 commit comments