Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
200 views
in Technique[技术] by (71.8m points)

php - Laravel 7 Artisan error - Argument 2 passed to IlluminateRoutingUrlGenerator::__construct() must be an instance of IlluminateHttpRequest

First of all I am kind of new in Laravel but I do like to learn and I really need your help fixing this error.

my project is cloned from my GitHub and all the steps i think I have done them as by the book :) however running Laravel installation at the end I've got the error

to be more specified.

  1. config.php is not present in config folder (in order to try as one suggestion rename it as config_ )
  2. I did tried without success all commands suggested in different resolutions php artisan cache:clear composer update composer dump-autoload

error right after installation

error trying artisan with bellow code live

I have read I think all of posts in regarding of this errors and trying all possibilities and actually found something but from here I've got stack

I understand that can be somewhere used url() or asset() - is the way I found the code bellow which is containing asset() and provoking this error but don't know what to use instead...

If I do get rid of the codes having asset in adminlte.php than artisan is working... any help on the correct code (how to replace those 3 asset add or what to change like for dummies :) will be much appreciated

    [
        'name' => 'SummerNote',
        'active' => true,
        'files' => [
            [
                'type' => 'css',
                'asset' => false,
                'location' => asset('vendor/summernote/summernote-bs4.css'),
            ],
            [
                'type' => 'js',
                'asset' => false,
                'location' => asset('vendor/summernote/summernote-bs4.min.js')
            ]
        ]
    ],
    [
    'name' => 'BsCustomFileInput',
    'active' => true,
    'files' => [
        [
            'type' => 'js',
            'asset' => false,
            'location' => asset('vendor/bs-custom-file-input/bs-custom-file-input.min.js')
        ]
    ]
]

] ];

code in configs/adminlte.php for artisan run

Thank you in advance if needed any other details I will be happy to provide and to have this fixed with your help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

this error generally occurs when you use a helper function to generate the url in your configuration files. Routing url generator also uses these helper functions so when you use this function inside of the config files then the url generator does not understand if it has to be rendered or simply taken as a string. Please make sure that you are not using any url() or asset() or other helpers functions inside your configuration files. use env() function to write your url or other function. and path functions like public_path() and storage_path() for directories


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...