jeudi 2 août 2018

Implicit Route Model Binding

Laravel's implicit route model binding isn't working. It is not looking up the record indicated by the identifier. I'm getting a brand new model object.

Given this code:

Route::get('users/{user}', function (App\User $user) {
    return [get_class($user), $user->exists, $user];
});

And this URL: /users/1

I get this output:

["App\\User",false,[]]

I'm on PHP 7.2 and Laravel 5.6.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire