Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 2.8 KB

MIGRATION.md

File metadata and controls

66 lines (46 loc) · 2.8 KB

2022-01-13

Migration to Laravel 8

  • Updating Laravel 7 to Laravel 8
  • Note: Minimum PHP version is now 7.3+

Following the Laravel 8 Upgrade Guide

Removing ipunkt/laravel-analytics

  • The package is not compatible with Laravel 8 and the package is not maintained anymore
  • Deleted config/analytics.php (No longer required)
  • Removed the Provider from config/app.php

We manually added the js code to the view and its available by activating it on the admin panel.

Seeder & Factory Namespace

According to the Laravel 8 Upgrade Guide, the namespace of the seeder and factory classes has changed.

  • Changed the folder database/seeds to database/seeders
  • Added namespace Database\Seeders to all the seeder Classes
  • Added namespace Database\Factories to all the factory Classes
  • Changed in composer.json file, removed classmap block from the autoload section and added the new namespaced class directory mappings in the psr-4 block
  • Updated UserFactory with the new structure (https://laravel.com/docs/8.x/database-testing#defining-model-factories)

Framework changes

Queue

  • Changed in config/queue.php, "the failed.driver configuration option within your queue configuration file should be updated to database-uuids"
  • Created new migration file for failed_jobs table with uuids and updated the failed_jobs table with the new structure
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
(to...)
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),

Automatic Controller Namespace Prefixing

  • Starting from Laravel 8, RouteServiceProvider the property $namespace is now null by default. This allows your controller route declarations to use the standard PHP callable syntax, which provides better support for jumping to the controller class in many IDEs:
use App\Http\Controllers\UserController;
 
// Using PHP callable syntax...
Route::get('/users', [UserController::class, 'index']);
 
// Using string syntax...
Route::get('/users', 'App\Http\Controllers\UserController@index');
  • Changed all the routes to use the PHP callable syntax, in routes/web.php and routes/api.php.
  • Set null the parameter $namespace from the constructor of the RouteServiceProvider class.

// TODO

https://laravel.com/docs/8.x/upgrade#automatic-controller-namespace-prefixing

Removed fzaninotto/faker dependency

  • Removed the package from composer.json because it dropped support.
  • Installed the new package fakerphp/faker and updated the code to use the new namespace.
  • Nothing should change in the code because it uses the same namespace.