Php Laravel 5.7中的auth和access之间有什么区别?
当我在Laravel 5.7中使用access时,它不是返回或支持。但我在laravel 5.3中使用accessPhp Laravel 5.7中的auth和access之间有什么区别?,php,laravel,Php,Laravel,当我在Laravel 5.7中使用access时,它不是返回或支持。但我在laravel 5.3中使用access 事件(新的UserLoggedIn(access()->user()); access()是以下目录中的用户定义方法 auth()是以下目录中的一个Laravel define方法 你能澄清你的问题吗?你想知道什么?access()不是Laravel助手函数,如果我能正确回忆的话。此功能是否使用第三方软件包?如果是,那是什么?这是我第一次在Laravel中看到accesshelp
事件(新的UserLoggedIn(access()->user());
你能澄清你的问题吗?你想知道什么?
access()
不是Laravel助手函数,如果我能正确回忆的话。此功能是否使用第三方软件包?如果是,那是什么?这是我第一次在Laravel中看到access
helper。我甚至在拉威尔5.3中找不到那些助手。
Directory : /app/helpers.php
Codes :
if (! function_exists('access')) {
/**
* Access (lol) the Access:: facade as a simple function.
*/
function access()
{
return app('access');
}
}
Directory : /vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
Codes :
if (! function_exists('auth')) {
/**
* Get the available auth instance.
*
* @param string|null $guard
* @return \Illuminate\Contracts\Auth\Factory|\Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard
*/
function auth($guard = null)
{
if (is_null($guard)) {
return app(AuthFactory::class);
} else {
return app(AuthFactory::class)->guard($guard);
}
}
}