What is the difference between auth and access in Laravel 5.7?

Viewed 98

When i use access in Laravel 5.7 it's not return or support. But I use access in laravel 5.3

event(new UserLoggedIn(access()->user()));
1 Answers
  1. access() is an user define method in the following directory
Directory : /app/helpers.php

Codes : 
   if (! function_exists('access')) {
        /**
        * Access (lol) the Access:: facade as a simple function.
        */
        function access()
        {
           return app('access');
        }
    }
  1. auth() is a Laravel define method in the following directory
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);
        }
    }
}
Related