Categories
Laravel

Upgrade from Laravel 6 to Laravel 8 ?

#1 – Make sure the composer.json looks like this

"require": {
   "php": "^7.2",
   "fideloper/proxy": "^4.0",
   "laravel/framework": "^8.0",
   "laravel/passport": "^10.0",
   "laravel/socialite": "^5.0",
   "laravel/tinker": "^2.0",
   "laravel/ui": "^3.0",
   "predis/predis": "^1.1"
},
"require-dev": {
   "facade/ignition": "^2.3.6",
   "mockery/mockery": "^1.0",
   "nunomaduro/collision": "^5.0",
   "phpunit/phpunit": "^9"
}

#2 – if you see following issue

laravel/framework replaces illuminate/support and thus cannot coexist with it.

Remove remove illuminate/support

composer remove illuminate/support

#3 – The report, render, shouldReport, and renderForConsole methods of your application’s App\Exceptions\Handler class should accept instances of the Throwable interface instead of Exception instances: Change app/Exceptions/Handler.php as follow

<?php

namespace App\Exceptions;

use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
   /**
    * A list of the exception types that are not reported.
    *
    * @var array
    */
   protected $dontReport = [
       //
   ];

   /**
    * A list of the inputs that are never flashed for validation exceptions.
    *
    * @var array
    */
   protected $dontFlash = [
       'password',
       'password_confirmation',
   ];

   /**
    * Report or log an exception.
    *
    * @param  \Throwable  $exception
    * @return void
    */
   public function report(Throwable $exception)
   {
       parent::report($exception);
   }

   /**
    * Render an exception into an HTTP response.
    *
    * @param  \Illuminate\Http\Request  $request
    * @param  \Throwable  $exception
    * @return \Illuminate\Http\Response
    */
   public function render($request, Throwable $exception)
   {
       return parent::render($request, $exception);
   }
}

Helper additional issue

php artisan config:clear
php artisan key:generate
php artisan config:clear

Leave a Reply