How to raise 404 with dependency injection laravel | Sololearn: Learn to code for FREE!

+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

7/15/2020 11:52:28 PM

Zachiah sawyer

2 Answers

New Answer

+1

0

A 404 error is a http protocol error . You mean that a user from it's navigator gets a 22p02 ?