Issue with illuminate request when upgrading to laravel 6 - laravel

I am getting the following code error after trying to upgrade to laravel 6 from 5.8, has anyone experienced this before?
Fatal error: Uncaught TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in C:\xampp\htdocs\rebuild\vendor\laravel\framework\src\Illuminate\Routing\RoutingServiceProvider.php on line 68 and defined in C:\xampp\htdocs\rebuild\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php:120
Stack trace:
#0 C:\xampp\htdocs\rebuild\vendor\laravel\framework\src\Illuminate\Routing\RoutingServiceProvider.php(68): Illuminate\Routing\UrlGenerator->__construct(Object(Illuminate\Routing\RouteCollection), NULL, NULL)
#1 C:\xampp\htdocs\rebuild\vendor\laravel\framework\src\Illuminate\Container\Container.php(799): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 C:\xampp\htdocs\rebuild\vendor\laravel\framework\src\Illuminate\Container\Container.php(681): Illuminate\Container\Container->build(Object(Closure))
#3 C:\xampp\htdocs\rebuild\vendor\laravel\framework\src\ in C:\xampp\htdocs\rebuild\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php on line 120

Similar issue is already listing on on Laravel repository and on Laracasts
It seems the problem is because of url() and asset() Helper functions used within in configuration files.
To resolve this error use config() or base_path or define absolute or relative paths in your config files instead of url() and assset() function for e.g
'cdn' => url('vendor/js/tinymce/tinymce.min.js'),
Changing it to
'cdn' => Config('app.url').'/vendor/js/tinymce/tinymce.min.js',
Change asset('home') to base_path('public/home'),
NOTE: You shouldn't use laravel dependencies inside config because the
config is loaded early in the request life cycle and things like
global helpers may not be available.
If you are using some dependencies in config file define them in .env files

Related

Illuminate\Routing\UrlGenerator::__construct(): Argument #2 ($request) must be of type Illuminate\Http\Request, null given

No command is working, I also tried to update Composer, but the case is the same. I found a guide that said to ignore the url() and asset() method, but it did not solve the issue.
Illuminate\Routing\UrlGenerator::__construct(): Argument #2 ($request)
must be of type Illumina te\Http\Request, null given, called in
D:\artyir\xampp8\htdocs\boilerplate\core\vendor\laravel\
framework\src\Illuminate\Routing\RoutingServiceProvider.php on line 65
I got that error message because I used url() in config folder.
Try not to use any url() or asset() in the config folder mainly in app.php.
I faced same problem when I used asset() function in some file in config folder, so try to remove any helper function from all config files, it prevents the loading of the app routes.
I solved this issue by changing this line:
asset('img/order_system/shopify.png')
to
'/img/order_system/shopify.png'
in config.

Laravel 4.2 Migrations issue

Can someone help me with this error? Got it during Laravel 4.2 Migrations
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Uncaught TypeError: Argument 1 passed to Illuminate\Exception\WhoopsDisplayer::display() must be an instance of Exception, instance of ParseError given, called in C:\Users\adejaremola\Desktop\UniServerZ\www\GoingFurther\bootstrap\compiled.php on line 9462 and defined in C:\Users\adejaremola\Desktop\UniServerZ\www\GoingFurther\bootstrap\compiled.php:9352\nStack trace:\n#0 C:\Users\adejaremola\Desktop\UniServerZ\www\GoingFurther\bootstrap\compiled.php(9462): Illuminate\Exception\WhoopsDisplayer->display(Object(ParseError))\n#1 C:\Users\adejaremola\Desktop\UniServerZ\www\GoingFurther\bootstrap\compiled.php(9414): Illuminate\Exception\Handler->displayException(Object(ParseError))\n#2 C:\Users\adejaremola\Desktop\UniServerZ\www\GoingFurther\bootstrap\compiled.php(9418): Illuminate\Exception\Handler->handleException(Object(ParseError))\n#3 [internal function]: Illuminate\Exception\Handler->handleUncaughtException(Object(ParseError))\n#4 {main}\n thrown","file":"C:\Users\adejaremola\Desktop\UniServerZ\www\GoingFurther\bootstrap\compiled.php","line":9352}}
It looks like you're trying to call the laravel's migration from the browser. It won't work here unfortunately.
You should run it from the CLI using command in the project root:
$ php artisan migrate

PHP Fatal error: A precedence rule was defined for > Illuminate\Foundation\Auth\AuthenticatesUsers::getGuard

I've just finished updating an app from Laravel 5.1 to 5.2. Everything is working fine on my local Homestead install. When I deploy to my forge server, the process is failing with the following error:
PHP Fatal error: A precedence rule was defined for
Illuminate\Foundation\Auth\AuthenticatesUsers::getGuard but this
method does not exist in
/home/forge/myapp/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
on line 11
What could be causing this? I've tried running composer dump-autoload after the update, but still no luck.
Any advice appreciated.
I fixed this by deleting /bootstrap/cache/compiled.php. The files the error refers to were fine.
The AuthenticatesAndRegistersUsers has a precedence statement to use getGuard from AuthenticatesUsers instead of from RegistersUsers.
The AuthenticatesUsers trait has a getGuard method defined in it.
Double check to make sure your version of that trait has the getGuard method and or double check those traits against the ones in the laravel repository.

Laravel 5 cache folder name causing classloader.php 412 error

When I uploaded my laravel 5 application to hostgator, i changed the name of one of the folders (instructor) that contains some controllers to (Instructors). However, I'm getting the error ErrorException in ClassLoader.php line 412
the applications is looking for controllers under the old folder name (instructor).
How can i fix this issue please?
Thank you
You can run the following command:
composer dumpautoload
perhaps u don't have controller.php file in the controllers folder under http folder of ur project.
Look for this file first..because in this file controller itself gets extended from basecontroller class, therefore it is necessary that this file should be there.

set_flashdata() triggers a fatal error in PyroCMS

I moved a Pyrocms site to another server.
Go to index: blank page.
Turn on errors: get this
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Pages::$session
Filename: core/Model.php
Line Number: 50
Fatal error: Call to a member function set_flashdata() on a non-object in /var/www/vhosts/brokentalkers.com/httpdocs/system/pyrocms/modules/modules/models/module_m.php on line 193
If it sheds any light, I made a tar.gz of the contents of the old httpdocs folder, and extracted it in the new httpdocs folder.
I made a duplicate of the database with an identical user, so config/database.php shouldn't need changing.
Any ideas? Thanks in advance.
It seems like $session class is not initializing correctly.
Check for default_ci_sessions table, if you are using sessions for database.
Check if the constructor is loading sessions library.
Check if session is in autoload.php config

Resources