Laravel-ide-helper: Auth::routes() Method 'routes' not found in Auth

Created on 3 Jun 2017  路  9Comments  路  Source: barryvdh/laravel-ide-helper

Routes method from the Auth facade is missing.

(Laravel 5.4 / IntelliJ IDEA)

stale

Most helpful comment

It already exists, but it obviously is in the Route class, so you could either add that block of code, or simply do it as Route::auth() which should work as well.

use Route::auth() since this one actually calls the correct function, in my opinion its better practice to use this one.

All 9 comments

In _ide_helper.php add the following code to the Auth class:

/**
* Routes for authentication.
*
* @return void
* @static
*/
public static function routes()
{
\Illuminate\Routing\Router::auth();
}

Currently trying to find a way to add this to the default generation

It already exists, but it obviously is in the Route class, so you could either add that block of code, or simply do it as Route::auth() which should work as well.

use Route::auth() since this one actually calls the correct function, in my opinion its better practice to use this one.

There is no autocompletion Route::middleware too :( Has an issue opened that describes it very well.

@caiocutrim method chain middleware() towards the end.

What about using extra?

config/ide-helper.php:

'extra' => array( 
    ...
    'Auth' => array('Illuminate\Support\Facades\Auth'), // add
),

Auth class in generated _ide_helper.php seems to has routes method.

 /*
         * The auth settings are defined in config/auth.php
         *
         * \Illuminate\Auth\AuthManager already added by default
         * @see \Illuminate\Auth\AuthServiceProvider::registerAuthenticator()
         * @see \Illuminate\Auth\AuthManager
         *
         * \Illuminate\Auth\RequestGuard is not a supported guard driver.
         * @see \Illuminate\Auth\AuthManager::viaRequest()
         * @see \Illuminate\Auth\RequestGuard
         *
         * Supported: "session", "token"
         * @see \Illuminate\Auth\AuthManager::resolve()
         * @see \Illuminate\Auth\AuthManager::createSessionDriver()
         * @see \Illuminate\Auth\AuthManager::createTokenDriver()
         * @see \Illuminate\Auth\SessionGuard
         * @see \Illuminate\Auth\TokenGuard
         */
        'Auth' => [
            \Illuminate\Auth\SessionGuard::class,
            \Illuminate\Auth\TokenGuard::class,
            \Illuminate\Support\Facades\Auth::class,
       ],
/*
         * @see https://laravel.com/docs/5.2/authentication
         * @see https://laravel.com/api/5.2/Illuminate/Auth.html
         * @see \Illuminate\Auth\AuthServiceProvider
         * @see \Illuminate\Auth\AuthManager::__call
         * @see \Illuminate\Contracts\Auth\Guard
         * @see \Illuminate\Contracts\Auth\StatefulGuard
         */
        'Auth' => [
            'check' => 'Illuminate\Contracts\Auth\Guard::check',
            'guest' => 'Illuminate\Contracts\Auth\Guard::guest',
            'user' => 'Illuminate\Contracts\Auth\Guard::user',
            'id' => 'Illuminate\Contracts\Auth\Guard::id',
            'validate' => 'Illuminate\Contracts\Auth\Guard::validate',
            'setUser' => 'Illuminate\Contracts\Auth\Guard::setUser',
            'attempt' => 'Illuminate\Contracts\Auth\StatefulGuard::attempt',
            'once' => 'Illuminate\Contracts\Auth\StatefulGuard::once',
            'login' => 'Illuminate\Contracts\Auth\StatefulGuard::login',
            'loginUsingId' => 'Illuminate\Contracts\Auth\StatefulGuard::loginUsingId',
            'onceUsingId' => 'Illuminate\Contracts\Auth\StatefulGuard::onceUsingId',
            'viaRemember' => 'Illuminate\Contracts\Auth\StatefulGuard::viaRemember',
            'logout' => 'Illuminate\Contracts\Auth\StatefulGuard::logout',
        ],

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

inderjeet1313 picture inderjeet1313  路  4Comments

marcus-clements picture marcus-clements  路  3Comments

ttomdewit picture ttomdewit  路  5Comments

neeravp picture neeravp  路  3Comments

beniaminorossini picture beniaminorossini  路  5Comments