New Laravel 6.x

Laravel Releases the new version of Laravel 6 (LTS) in 3rd September 2019. For Laravel 6 (LTS) releases, bug fixes are provided for 2 years and security fixes are provided for 3 years. And for general releases, bug fixes are provided for 6 months and security fixes are provided for 1 year. Here, I will show you the updated table with versions and dates of the latest versions of Laravel:

Version

Release

Bug
Fixes Until

Security
Fixes Until

5.5
(LTS)

August
30th, 2017

August
30th, 2019

August
30th, 2020

5.6

February
7th, 2018

August
7th, 2018

February
7th, 2019

5.7

September
4th, 2018

March
4th, 2019

September
4th, 2019

5.8

February
26th, 2019

August
26th, 2019

February
26th, 2020

6
(LTS)

September
3rd, 2019

September
3rd, 2021

September
3rd, 2022

What’s New in Laravel 6?

In this article, I will discuss the new features in Laravel 6:
1. Semantic Versioning:
Semantic versioning is a kind of giving the number Major, Minor and Patch, increment the:

  • Major version when you make incompatible API changes,
  • Minor version when you add functionality in a backwards compatible manner, and
  • Patch version when you make backwards compatible bug fixes.

So, The Laravel framework (laravel/framework) package follows the versioning standards. This makes the framework consistent with the other first-party Laravel packages which already followed this versioning standard and the Laravel release cycle will remain unchanged.

2. Ignition Error Page:
It is a new error page or a new open source exception page for Laravel 6. This is contributed by the team behind Spatie and Beyond code. Ignition is a gorgeous and extensible error page for Laravel application. It is the default error page for all Laravel 6 applications.
For example: Install Laravel6 and just change the view name in web.php file and run the project. You will get error page like this:
Ignition offers many benefits over previous release, such as improved Blade error file and line number handling, runnable solutions for common problems, code editing, exception sharing, and an improved UX.
For example: Install ignition code editor: composer require facade/ignition-code-editor –dev
And run the project, you will notice code editor in error page, like this:

3. Improved Authorization Responses:
In Laravel 6, there is new Gate::inspect method introduced, which make easier the authorization response message. Whereas in previous release of Laravel, it was difficult to retrieve and expose custom authorization messages to end users. The authorization policy’s response and message may be easily retrieved using the Gate::inspect method:

4. Job Middleware:
This feature is implemented by Taylor Otwell. Job middleware allow you to wrap custom logic around the execution of queued jobs, reducing boilerplate in the jobs themselves.
In Laravel 6, Job Middleware allows jobs to run through middleware. The middleware will help you avoid custom logic in the body of your job’s handle() method.

5. Lazy Collections:
Laravel 6 introduced a LazyCollection, which is a game-changer for working with an extensive collection of data, including Eloquent model collections. A new Illuminate\Support\LazyCollection class leverages PHP’s generators to allow you to work with very large datasets while keeping memory usage low.
For example: Imagine you need to iterate through 10,000 Eloquent models. When using traditional Laravel collections, all 10,000 Eloquent models must be loaded into memory at the same time:

6. Eloquent Subquery:
This Eloquent Subquery Enhancement is contributed by Jonathan Reinink. Laravel 6 ships with improved support for eloquent subqueries. In this you may now add subqueries by using the new addselect() method, or by passing a closure to the orderBy() and from() method of the query builder.
For example: Suppose we have a table of flight destinations and a table of flights to destinations. The flights table contain an arrived_at column which indicates when the flight arrived at the destination.
So, In Laravel 6 using a single query we can select all of the destinations and the name of the flight that most recently arrived at that destination: addSelect().
In addition, we can use new subquery features added to the query builder orderBy() function to sort all destinations based on when the last flight arrived at that destination. This may be done while executing a single query against the database, like this:

7. Frontend Scaffolding or Laravel UI:
In Laravel 6, the frontend scaffolding is now extracted into separate laravel/ui composer package. Means that no Bootstrap or Vue code is present in default framework scaffolding, and the make:auth command has been extracted from the framework as well. When installing a fresh larvel6 application, you will notice that the login and registration scaffolding, as well as the Vue/jquery/bootstrap in your app.js file have been extracted to a new composer package (laravel/ui).
For example: Install Laravel6 and Laravel5 and open the app.js file of both file. You will get the difference between them:
• Laravel5.x: open resources/js/app.js file:
• Laravel6.x: open resources/js/app.js file:
In Laravel 6, you may install the laravel/ui package and use ui Artisan command to install and restore the traditional Vue/Bootstrap and frontend scaffolding present in previous release of Laravel.
Installing laravel/ui package: Run composer require laravel/ui –dev
After installing laravel/ui package then install Authentication scaffolding: Run php artisan ui vue –auth

© 2023 aynsoft.com - Website Development, Software Development Company India