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

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time