Search code examples
phplaravellumen

Implicit route model binding in Lumen?


I'm trying to use implicit route model binding in Lumen but seems it's not working.

Is there anyway to enable this?

$app->get('/users/{user}', 'UsersController@get');

It's just returning the value in user but it's not type hinting it and returning the model.


Solution

  • I ran into the same issue recently and doubt that it's possible. Lumen 5.2 does not use the Illuminate router but FastRoute instead. more info on the differences here However, it should be possible to write a custom middleware if that's an option.