How to upgrade Laravel from 6.0 to Laravel 7.0?
1
To upgrade Laravel 6.0 to Laravel 7.0, use the following steps:
Step 1:
Update the composer.json file with the following:
laravel/framework to ^7.0
nunomaduro/collision to ^4.1
phpunit/phpunit to ^8.5
laravel/tinker to ^2.0
facade/ignition to ^2.0
Step 2:
Now you need to update the following file:
app/Exceptions/Handler.php
Replace the following Exception Functions of app/Exceptions/Handler.php
public function report(Exception $exception) // replace Exception with Throwable
{
parent::report($exception);
}
public function render($request, Exception $exception) // replace Exception with Throwable
{
return parent::render($request, $exception);
}
with the following Throwable functions. It should look like the following:
use Throwable;
public function report(Throwable $exception)
{
parent::report($exception);
}
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
Step 3:
Now upgrade the Laravel version by running the following command:
composer update
Step 4:
Now check the Laravel version by this command:
php artisan --version