Search code examples
phplaravelruntime-errorlaravel-5

Catchable fatal error: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given


I'm getting this error when I try to run php artisan (anything):

PHP Catchable fatal error:  Argument 2 passed to
Illuminate\Routing\UrlGenerator::__construct()
must be an instance of Illuminate\Http\Request, null given, called in
/www/laravel5/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php
on line 56 and defined in
/www/laravel5/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php
on line 81

Catchable fatal error: Argument 2 passed to
Illuminate\Routing\UrlGenerator::__construct()
must be an instance of Illuminate\Http\Request, null given, called in
/www/laravel5/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php
on line 56 and defined in
/www/laravel5/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php
on line 81

I have absolutely no idea what is causing it and need help with it.

Thanks in advance


Solution

  • Well I discovered what generated the error.

    In config/services.php I was doing this:

    'facebook' => [
        'client_id'     => env('FACEBOOK_APP_ID', null),
        'client_secret' => env('FACEBOOK_APP_SECRET', null),
        'redirect'      => url('auth/facebook'),
    ]
    

    url('auth/facebook') is what caused the error.