Skip to content

Laravel 8.x Shift#12235

Merged
murrant merged 29 commits intomasterfrom
shift-35189
Nov 3, 2020
Merged

Laravel 8.x Shift#12235
murrant merged 29 commits intomasterfrom
shift-35189

Conversation

@Jellyfrog
Copy link
Copy Markdown
Member

This pull request includes the changes for upgrading to Laravel 8.x. Feel free to commit any additional changes to the shift-35189 branch.

Before merging, you need to:

  • Checkout the shift-35189 branch
  • Review all pull request comments for additional changes
  • Update your dependencies for Laravel 8
  • Run composer update (if the scripts fail, add --no-scripts)
  • Thoroughly test your application (no tests?)

If you need help with your upgrade, check out the Human Shifts. You may also join the Shifty Coders Slack workspace to level-up your Laravel skills.

@Jellyfrog
Copy link
Copy Markdown
Member Author

ℹ️ Shift noticed you have additional namespaces in your application. You may use the Consolidate Namespaces Shift to simplify your namespaces into the default Laravel App namespace.

@Jellyfrog
Copy link
Copy Markdown
Member Author

ℹ️ Laravel 8 streamlined the Exception Handler into a single register method to make it easier to add custom logic around rendering or reporting errors within your application.

While this change is not required, Shift recommends comparing yours against the Laravel 8.x version as an opportunity to reduce code and be fully up-to-date.

@Jellyfrog
Copy link
Copy Markdown
Member Author

ℹ️ The RouteServiceProvider no longer prefixes the controller namespace by default in Laravel 8. While you may still set this property, you are encouraged to register your routes using static ::class references.

You may automate the conversion to static class references using the Shift Workbench.

@Jellyfrog
Copy link
Copy Markdown
Member Author

❌ Laravel 8 condenses the RouteServiceProvider as well as configured the new rate limiters. Shift was unable to automate this change. You should compare yours against the Laravel 8.x version and merge any changes.

@Jellyfrog
Copy link
Copy Markdown
Member Author

⚠️ Shift found multiple model factory definitions in database/factories/ModelFactory.php which it may not have properly converted. To receive the full automation you must first split these into individual factories, then request a rerun. You may use the Shift Workbench to help separate your model factory.

@Jellyfrog
Copy link
Copy Markdown
Member Author

ℹ️ Laravel 8 introduced class based factories. Shift automated this change. However, if you were using a community package for factories or other custom code, you should review your factories for additional changes.

If you encounter an issue, you may revert this commit and temporarily install the laravel/legacy-factories package. You may then automate the conversion to class based factories using the Shift Workbench.

@Jellyfrog
Copy link
Copy Markdown
Member Author

ℹ️ Laravel 8 added a uuid column to the failed_jobs table to support the new job batching features.

If your application is currently using the failed_jobs table, you may generate a custom migration for this command by running:

php artisan make:migration AddUuidToFailedJobsTable

Then copy and paste the contents from Shift's AddUuidToFailedJobsTable class.

@Jellyfrog
Copy link
Copy Markdown
Member Author

ℹ️ Laravel 8 added a new ENV variable of LOG_LEVEL. While the log level is defaulted in the configuration, you may take this opportunity to set it accordingly in your environments.

@Jellyfrog
Copy link
Copy Markdown
Member Author

⚠️ Shift upgraded your configuration files by defaulting them and merging your true customizations. These include values which are not changeable through core ENV variables. This should make maintaining your config files easier.

You should review this commit for any additional customizations. If you have a lot of customizations, you may wish to undo this commit with git revert and make these config file changes manually.

@Jellyfrog
Copy link
Copy Markdown
Member Author

ℹ️ Shift updated your dependencies for Laravel 8. While many of the popular packages are reviewed, you may have to update additional packages in order for your application to be compatible with Laravel 8.

Watch dealing with dependencies for tips on handling package incompatibilities.

@Jellyfrog
Copy link
Copy Markdown
Member Author

⚠️ Laravel 8 now requires PHPUnit 9 which made some configuration changes to its config file. You may automate these changes by running vendor/bin/phpunit --migrate-configuration or comparing your phpunit.xml to the Laravel 8 version and merging any changes.

@Jellyfrog
Copy link
Copy Markdown
Member Author

⚠️ The paginator now uses Tailwind for its default styling in Laravel 8. If you wish to continue using Bootstrap, you should add the following snippet to the boot method of your AppServiceProvider:

\Illuminate\Pagination\Paginator::useBootstrap();

@Jellyfrog
Copy link
Copy Markdown
Member Author

🎉 Congratulations, you're now running the latest version of Laravel.

The following Shifts may be used ensure your application is fully upgraded and easier to maintain in the future:

  • Upgrade Checker ensures your application is fully upgraded by detecting any outdated code.
  • Laravel Fixer automates many of the suggestions found by the Laravel Linter and other Shifts.
  • Tests Generator intelligently generates model factories, HTTP Tests, and unit tests for your application to give you a head start on testing.

You may run these Shifts and stay upgraded forever as well by subscribing to a Shifty Plans.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Oct 20, 2020

CLA assistant check
All committers have signed the CLA.

@Jellyfrog Jellyfrog force-pushed the shift-35189 branch 2 times, most recently from 1ee54d5 to 3a0010d Compare October 21, 2020 00:50
@Jellyfrog
Copy link
Copy Markdown
Member Author

@librenms/reviewers Need help testing this

@murrant
Copy link
Copy Markdown
Member

murrant commented Oct 25, 2020

Testing went fine here. I'll test the update next.

laravel-shift and others added 11 commits November 3, 2020 01:50
In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them. This allows you to review the commit
diff for once for customizations when you are done Shifting.

Moving forward, consider using ENV variables or create a separate
config file to allow the core config files to remain as default
as possible.
From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type:

- `setUpBeforeClass()`
- `setUp()`
- `assertPreConditions()`
- `assertPostConditions()`
- `tearDown()`
- `tearDownAfterClass()`
- `onNotSuccessfulTest()`

[1]: https://phpunit.de/announcements/phpunit-8.html
@murrant murrant merged commit 50c8033 into master Nov 3, 2020
@murrant murrant deleted the shift-35189 branch November 3, 2020 16:18
@murrant
Copy link
Copy Markdown
Member

murrant commented Dec 2, 2020

This pull request has been mentioned on LibreNMS Community. There might be relevant details there:

https://community.librenms.org/t/v1-69-release-changelog-november-2020/14124/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants