The Laravel team has release Laravel 6 on 3rd September 2019 and it’s now available for developers. According to the release notes, this release of Laravel framework (laravel/framework follow Semantic Versioning standard.
Also, this release is compatible with Laravel Vapor.
Laravel 6 Versioning Schema
Laravel 6.0 is the new LTS version of Laravel and a major release. Major releases of laravel happen every six months. And this version of laravel comes with bugfixes until September 3rd, 2021 and security fixes until September 3rd, 2022.
However, laravel team may release minor and patch as often as every week.
Ignition: Error Page for Laravel
Apparently, Laravel 6.0 has a new default error page. Ignition is the new error page. It comes with new features and stack traces which make debugging significantly better. Most importantly, Ignition created a couple of first-party extensions that add to its functionality.
Improved Authorization Responses
Certainly, if you have worked the previous versions of laravel, you probably have difficulty providing custom authorization messages to end users. With the introduction of Gate::inspect
method in laravel 6, authorization response messages are made easier. For instance, given the policy method:
public function view(User $user, Post $post)
{
return $this->deny('Post access denied.');
}
Gate::inspect
method can be used to retrieve the authorization policy’s response:
$response = Gate::inspect('view', $post);
if ($response->allowed()) {
// User is authorized to view the post...
}
if ($response->denied()) {
echo $response->message();
}
Job Middleware
Taylor Otwell added a new feature that allows jobs to run through middleware. For instance, a middleware class name PostMiddleware may be attached to a job by returning it from the job’s middleware method:
use App\Jobs\Middleware\PostMiddleware;
public function middleware()
{
return [new PostMiddleware];
}
Lazy Collections
Frankly speaking, many developers do enjoy the power Laravel’s Collection methods. But, Lazy collections supplement the already powerful Collection class, if you are working with a large collection of data. In addition, lazy collection leverages PHP’s generators to work with very large datasets while keeping memory usage low. You can check out the documentation on the Lazy Collections for more details.
Eloquent Subquery Enhancements
Subqueries make it possible to nest queries within another database query. And in laravel 6, support for subqueries to both the select()
and addSelect()
query builder methods have been added. However, check out the documentation on Advanced Subqueries for more details.
Laravel UI
First of all, frontend scaffolding in the previous versions of Laravel has been extracted into a separate laravel/ui Composer package. So, the first-party UI scaffolding can be iterated on separately from the primary framework.
However, to still work with the default Bootstrap/Vue scaffolding, run the following command:
composer require laravel/ui --dev
php artisan ui vue --auth
Top comments (0)