samedi 25 avril 2020

How to pass optional ID to Laravel Controller from Route?

I want to pass an ID to my controller from Routes:

Route::get('user/{id?}', function ($id= null) {
    return $id;
});

However, I'm not sure where to put the controller name and function?

MyController@get

Laravel's documentation and other questions don't seem to be related to this issue.

What am I missing here?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/354obVb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire