Request param is string but model still return data #42484
Unanswered
simpsons310
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel version: 9.9.0
PHP version: 8.1.6
I have 1 route like this:
In the
RoomController
:In my database, in
rooms
table, I have a record hasid = 74
When I try to call a
patch
to routeroom/74
, in the controller,$room
returns a correctRoom
model object withid = 74
. But when I type some string after74
, it still returns theRoom
object withid = 74
to$room
variable. e.g.room/74wasdsaw
.I also tried to
dd($request->all())
and it returned74wasdsaw
I wonder if this is a bug or a laravel's feature. If it's a feature, what is the purpose to?
Beta Was this translation helpful? Give feedback.
All reactions