How to raise 404 with dependency injection laravel | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to raise 404 with dependency injection laravel

If i have these routes Route::resource('users', 'UsersController') And this in my controller public function show(User $user) { ... } When a user visits a url with a bad Id like /users/hello Then it will generate a SQLstate[22P02] error. How can I make this a 404

15th Jul 2020, 11:52 PM
Zachiah sawyer
Zachiah sawyer - avatar
1 Answer
+ 1
Yes
20th Jul 2020, 12:51 AM
Zachiah sawyer
Zachiah sawyer - avatar