Hesto / multi-auth

Laravel 5.3, 5.4, 5.5, 5.6, 5.7 multi auth package
MIT License
448 stars 146 forks source link

ErrorException thrown with message "Undefined offset: 0" #125

Open dhsananias opened 6 years ago

dhsananias commented 6 years ago

I just installed the package, however, when I finished running the php artisan commands, it returns me the following message

ErrorException thrown with message "Undefined offset: 0"

Stacktrace:

27 ErrorException in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Routing\Router.php:1218

26 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Routing\Router.php:1218

25 Illuminate\Routing\Router:__call in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php:98

24 call_user_func_array in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php:98

23 Illuminate\Foundation\Support\Providers\RouteServiceProvider:__call in C:\laragon\www\brasilJoias\app\Providers\RouteServiceProvider.php:42

22 App\Providers\RouteServiceProvider:map in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29

21 call_user_func_array in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29

20 Illuminate\Container\BoundMethod:Illuminate\Container{closure} in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87

19 Illuminate\Container\BoundMethod:callBoundMethod in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31

18 Illuminate\Container\BoundMethod:call in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\Container.php:564

17 Illuminate\Container\Container:call in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php:74

16 Illuminate\Foundation\Support\Providers\RouteServiceProvider:loadRoutes in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Support\Providers\RouteServiceProvider.php:33

15 Illuminate\Foundation\Support\Providers\RouteServiceProvider:boot in C:\laragon\www\brasilJoias\app\Providers\RouteServiceProvider.php:28

14 App\Providers\RouteServiceProvider:boot in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29

13 call_user_func_array in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29

12 Illuminate\Container\BoundMethod:Illuminate\Container{closure} in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87

11 Illuminate\Container\BoundMethod:callBoundMethod in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31

10 Illuminate\Container\BoundMethod:call in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Container\Container.php:564

9 Illuminate\Container\Container:call in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:800

8 Illuminate\Foundation\Application:bootProvider in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:783

7 Illuminate\Foundation\Application:Illuminate\Foundation{closure} in [internal]:0

6 array_walk in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:784

5 Illuminate\Foundation\Application:boot in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\BootProviders.php:17

4 Illuminate\Foundation\Bootstrap\BootProviders:bootstrap in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:206

3 Illuminate\Foundation\Application:bootstrapWith in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:162

2 Illuminate\Foundation\Http\Kernel:bootstrap in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:146

1 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in C:\laragon\www\brasilJoias\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:116

0 Illuminate\Foundation\Http\Kernel:handle in C:\laragon\www\brasilJoias\public\index.php:55

public function __call($method, $parameters)
{
    if (static::hasMacro($method)) {
        return $this->macroCall($method, $parameters);
    }

    if ($method == 'middleware') {
        return (new RouteRegistrar($this))->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters);
    }

 ->>>>> HERE   return (new RouteRegistrar($this))->attribute($method, $parameters[0]);
}

But it does not seem to make sense, since I give a dd ($ parameters) and yes, it finds a value in index 0

rrmesquita commented 6 years ago

I think I've found the answer for this issue. All i did was add these lines in RouteServiceProvider.php

protected function mapAdminRoutes()
    {
        Route::prefix('admin')
             ->middleware('admin')
             ->namespace($this->namespace)
             ->group(base_path('routes/admin.php'));
    }

Of course, these are the configurations for the "admin" Auth wich I believe is the most common one for the people who use this package. So if you have another Auth, just replace "admin" for whatever you're using.

In this repo README there is a note saying that it was automatically added when you installed a new Auth. But I'm using the latest version and still facing this issue.

Also, if doesn't solve your problem, please let me know.

amitshahc commented 6 years ago

I think I've found the answer for this issue. All i did was add these lines in RouteServiceProvider.php

protected function mapAdminRoutes()
    {
        Route::prefix('admin')
             ->middleware('admin')
             ->namespace($this->namespace)
             ->group(base_path('routes/admin.php'));
    }

Of course, these are the configurations for the "admin" Auth wich I believe is the most common one for the people who use this package. So if you have another Auth, just replace "admin" for whatever you're using.

In this repo README there is a note saying that it was automatically added when you installed a new Auth. But I'm using the latest version and still facing this issue.

Also, if doesn't solve your problem, please let me know.

This worked exactly and solved my issue.

but now facing In "Migrator.php line 417: Class '' not found" error