Spark 7.0 error with Route Model Binding

Posted 1 month ago by mariohbrino

I have one issue with Laravel Spark 7.0, the route model binding doesn't abort when it passes a string. It works fine at Laravel 5.7, only in Spark it happens.

Any one can help me with this? Thanks.

Route

Route::get('api/users/{user}', function (App\User $user) {
    return $user->email;
});

Example: app.local/api/user/test

Result

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "test" (SQL: select * from "users" where "id" = test limit 1)

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.