With Laravel v5.3 just getting acquainted.

Help with the solution of the question: how can you process a GET request of the form: /user/{uuid}/info you need to get from the address bar uuid on it will refer to the database and get information on the user.

 Route::get('/user/{uuid}/info', function () { $uuid= Request::input('uuid'); - знаю что здесь ошибка. if (Auth::attempt(array('id' => $uuid))){ $userInfo = [ 'firstName' => Auth::user()->firstName, 'lastName' => Auth::user()->lastName, ]; return Redirect::to('userInfo')->with(Auth::user()->lastName); } else { return Redirect::to('user/register'); } }); 

Thank you for the response.

  • one
    Add $ uuid variable to the input argument for the function, and use it ... function ($ uuid) {.... - Jbyh

1 answer 1

 Route::get('/user/{uuid}/info', function ($uuid) { // to do }); 

try this

If more parameters are passed, then:

 Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) { // }); 

Names do not have to be the same.