流明框架中的“封闭”类在哪里?

问题描述 投票:-2回答:1

管腔内部的许多过程都使用“ closure”类。我知道闭包是什么,但我仍然想知道它在流明的外观。因此,我需要找到定义类的文件。

例如,我的authenticate.php中间件使用“关闭”,您可以在代码顶部看到它:

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Contracts\Auth\Factory as Auth;

class Authenticate
{
    /**
     * The authentication guard factory instance.
     *
     * @var \Illuminate\Contracts\Auth\Factory
     */
    protected $auth;

    /**
     * Create a new middleware instance.
     *
     * @param  \Illuminate\Contracts\Auth\Factory  $auth
     * @return void
     */
    public function __construct(Auth $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        if ($this->auth->guard($guard)->guest()) {
            return response('Unauthorized.', 401);
        }

        return $next($request);
    }
}

但是与流明中的任何其他类不同,该类不提供任何指向该类在源代码中位置的路径。我已经查找了根目录,但它不在那里。

所以在哪里?

php laravel lumen
1个回答
4
投票
© www.soinside.com 2019 - 2024. All rights reserved.