I'm pretty new to Lumen and I'm following this tutorial to learn a basic authentication with JWT through Lumen: https://medium.com/tech-tajawal/jwt-authentication-for-lumen-5-6-2376fd38d454
Now its this part of code which puts some questionmarks over my head:
$router->group(
['middleware' => 'jwt.auth'],
function() use ($router){
$router->get('users', function(){
$users=\App\User::all();
return response()->json($users);
});
}
);
I dont understand what function() use ($router)
does?
I read the official of PHP on use: https://www.php.net/manual/de/language.namespaces.importing.php
And I also looked into an external ressource:
https://www.tutorialspoint.com/php7/php7_use_statement.htm
But I guess I would still require some knowledge about the inner workings of Lumen/Laravel to understand whats happening here. Can someone please give me a lift and explain to me in a few lines whats happening here?