input('age')<18) return redirect()->route('refuse'); return $next($request); } }
In the above code,
1) The closure in use Closure in the third line is a class? how come?
2) What does Closure $next mean in the handle method on line 6?
3) $next($request) on line 9, what is the usage? Is $next a function or a variable?
Closure is a class that comes with PHP to represent anonymous functions! ! Go to the PHP manual and you will understand the questions you asked.
Closure is a class used by PHP to implement closures (anonymous functions).
http://php.net/manual/zh/class.closure.php
$next is the bound function.