我发现它有点难于理解Facades。特别是如何从外观名称中找到基础类名/位置。我已经通过了文档,但仍不清楚。例如,当使用Auth::login()
时,我发现在Auth正面没有login()
方法。如何从Laravel的Facade名称中获取底层类名
class Auth extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'auth';
}
/**
* Register the typical authentication routes for an application.
*
* @return void
*/
public static function routes()
{
static::$app->make('router')->auth();
}
}
的验证外墙getFacadeAccessor()
方法返回一个字符串AUTH。但是我应该在哪个课程上看到auth
?如何解决实际的课堂?
感谢,
这可能是有用的https://laravel.com/docs/5.5/facades#how-facades-work如果您向下滚动一下,您将看到哪个门面对应于哪个类 – Christophvh