Framework: Running artisan db:seed finishes with:聽Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given

Created on 30 Mar 2020  路  7Comments  路  Source: laravel/framework


  • Laravel Version: 5.8
  • PHP Version: 7.4
  • Database Driver & Version: n/a

Description:

Running artisan db:seed finishes with: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given

Steps To Reproduce:

Use some config/xxx.php file with instruction calling asset:
'name' => '<img src="' . asset('images/some.png') . '" width="20"> XYZ',

Laravel will work correctly, however artisan will crash with the above mentioned error.

Most helpful comment

asset() helper can't be used in config file.

All 7 comments

Hey there,

Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? We'll help you out and re-open this issue if so.

Thanks!

asset() helper can't be used in config file.

@driesvints Still the same issue occurs on Laravel v7.25.0 (reproduction is the same as the one mentioned by OP).

asset() helper can't be used in config file.

This seems to be the problem. I am able to reproduce the issue in Laravel v7.

@driesvints can you confirm if this is a bug / expected behaviour?

@shahalpk

You can override config value in AppServiceProvider.

    public function boot()
    {
        config([
          'xxx.value' => '<img src="' . asset('images/some.png') . '" width="20"> XYZ'
       ]);
    }

@shahalpk expected

@driesvints okie. but shouldn't the error message be more meaningful?

Was this page helpful?
0 / 5 - 0 ratings