Laravel’s major update version 6
Laravel is a free, open-source PHP web framework, created by Taylor Otwell. Especially for the development of web applications following the model–view–controller architectural pattern also based on Symfony. In this blog, let’s see What’s new in Laravel 6.x.
New awesome features in Laravel 6
This release also includes compatibility with Laravel Vapor, improved authorization responses, job middleware, lazy collections, sub-query improvements, among many other improvements.
The new LTS Version
Laravel 6.0 brings the new LTS version of Laravel, this includes bug fixes until September 3rd, 2021 and security fixes until September 3rd, 2022. Here’s the updated table with versions and also the dates of the latest versions of Laravel:
Version | Release | Bug Fixes Until | Security Fixes Until |
---|---|---|---|
5.1 (LTS) | Jun 9th, 2015 | Jun 9th, 2017 | 9th Jun 2018 |
5.5 (LTS) | Aug 30th, 2017 | August 30th, 2019 | Aug 30th, 2020 |
6.0 (LTS) | Sept 3rd, 2019 | September 3rd, 2021 | Sept 3rd, 2022 |
New Laravel UI
The frontend scaffolding provided with Laravel 5.x releases is now extracted into a separate laravel/UI Composer package. This also allows first-party UI scaffolding to be iterated on separately from the primary framework.
If you also want the Traditional Bootstrap/Vue/ scaffolding, you will also run the following command:
1 2 |
acomposer require laravel/ui php artisan ui vue --auth |
Semantic Versioning
Laravel release notes clarify semantic versioning going forward in Laravel 6.0 and beyond:
The Laravel framework (laravel/framework) package now also follows the semantic versioning standard. This makes the framework consistent with the other first-party Laravel packages which already followed this versioning standard. The Laravel release cycle will remain unchanged.
Ignition Error Page
Laravel 6.0 now ships with Ignition—a new open-source exception page for Laravel—created by Freek Van der Herten and Marcel Pociot.
Improved Authorization Responses
Previously it was difficult to provide custom error messages around authorization to end-users. Laravel 6 introduces a Gate::inspect
method which also provides the authorization policy’s response:
1 2 3 4 5 6 7 8 9 |
$response = Gate::inspect('view', $bagisto); if ($response->allowed()) { // User is authorized to view the bagisto... } if ($response->denied()) { echo $response->message(); } |
Job Middleware
You define middleware by specifying a middleware()
method on the job class which returns an array of middleware objects. From the pull request, here’s an example:
1 2 3 4 |
public function middleware() { return [new SomeMiddleware]; } |
the middleware class:
1 2 3 4 5 6 7 8 9 |
class SomeMiddleware { public function handle($command, $next) { // Do something... return $next($command); } } |
Lazy Collections
Lazy collections are also a game-changer for working with extensive collections of data, including Eloquent model collections.
A new Illuminate\Support\LazyCollection
class leverages PHP’s generators to keep memory low while working with large datasets. Check out Lazy Collections documentation for more details on this impressive new feature!
Eloquent Subquery Enhancements
Subqueries allow you to run nested queries within another database query. This can also be a powerful way to retrieve ancillary model data, without making any additional database queries.
when it’s not possible to do via a relationship.
Moreover, you can also use subqueries in order by
statements, where
statements, and also other database clauses.
1 2 3 4 5 |
return Destination::addSelect(['last_flight' => Flight::select('name') ->whereColumn('destination_id', 'destinations.id') ->orderBy('arrived_at', 'desc') ->limit(1) ])->get(); |
Thanks for reading the blog about What’s new in Laravel 6.x still, have any issue also feel free to add a ticket at https://bagisto.uvdesk.com/en/