Upgrading a Laravel app shouldn't be diffcult if you follow the documentation on the laravel website. In case you encounter any bug while follow this tutorial, a Google search would help.
I'll try my best to explain how to upgrade your laravel app from version 8.12 to 8.40 in six (6) steps below.
Step 1: Go to laravel github repository on github by clicking here. By default, the branch is 8.x as the time I am writing this article.
Step 2: Click on the composer.json file.
Step 3: Inside the composer.json file, on line 12 as the time of writing this article. Copy the laravel version ("laravel/framework": "^8.40"). Open the project you want to upgrade in your favorite IDE and click on the composer.json file.
Step 4: The current laravel app version is 8.12, replace the laravel version to the version you copied in step 3.
Step 5: Open your terminal and run composer update
Step 6: run php artisan --version in your terminal to get your laravel app version.
You can upgrade from other versions to any version you desire using this article as a guide. If you find this article useful, don't forget to click on the share button!
You can follow me on twitter @kabiryusufbashi