Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

What are the 5 New Features of Laravel 5.8

Author: Dashmeet Kaur
by Dashmeet Kaur
Posted: Apr 26, 2019

Dedicated Laravel developers are out with yet another release. Yes, Laravel 5.8 is now released and accessible to everyone. This update is the finest version of Laravel with several rich features to improve the core of this framework. Along with that Laravel 5.8 will be the ultimate bug fixer. Let’s take a glance at the advanced features of Laravel’s latest version to discover the difference:

Discovery of Automatic Policy

The policy is an ideal way to handle Laravel’s user authorization. Basically, policies are the classes which systematically organizes authorization logic around a specific model or resource. In the previous versions of Laravel, policies were manually registered in the Authserviceprovider. However, Laravel 5.8 adopts the non-conventional method to register the policies.

In this, there is no need to manually register a model’s authorization policy instead Laravel can auto-discover those policies that follow standard Laravel naming conventions and whose directory is in default locations. In case you want to register models or policies outside the default Laravel structure then, you can use a custom callback method known as, Gate:guessPolicyNamesUsing method. This feature is highly appreciated by Laravel development companies as it saves the time that gets wasted on writing code each time a policy class is generated.

Update Your Cache

Laravel 5.8 embraces a better caching system for agile Laravel development services. In Laravel’s previous version caching was set into minutes but now Laravel 5.8 has speed up the process to seconds. It offers more granular control over cache duration and consents to the standard norms of PSR-16.In order to cache in your application remember to update in seconds as below:

Cache : :remember(‘active-posts’, now()->addseconds(30), function () {

return Post: :active()->get();

});

HasOneThrough eloquent relationship

Laravel 5.8 renders a new eloquent relationship, HasOneThrough. Although it is new to Laravel, other frameworks like Rails already support this feature. This simplifies the task of many dedicated Laravel developers. For instance, if you have three models; a Supplier model, an Account model, and an AccountHistory model. That implies a Supplier has an Account and an Account has one AccountHistory.

Earlier to get a supplier’s account history, Laravel developer needs to find the supplier then write something like $supplier->account->accountHistory. Now a developer can easily use a "HasOneThrough" relationship to skip this step, availing a supplier’s account history straight away like this:

$history = $supplier->accountHistory through the account model such as:

Public function accounHistory()

{

return $this->hasOneThrough(AccountHistory::class, Account::class);

}

Refined Email Validation

Laravel 5.8 focuses on improving every weak aspect shared by the older versions of Laravel. It brings a progressive change namely, egulias/email-validator, that allows international characters in email addresses. Laravel’s previous validation logic considers valid emails like example@bär.se as invalid but with Laravel 5.8 any complex email address will be approved, which can be the biggest boon for a Laravel development company.

Error Page Templates

The latest version of Laravel configures on a new error page template. It contains minimal design pattern that compliments an array of websites and web applications without the demand to re-design to fit a particular theme. The accessibility of these templates makes it convenient for Laravel developers to create dynamic applications without much hassle.

Laravel 5.8 is loaded with rich features, while these were just a few unique features of Laravel that revolutionize the previous updates. If you want to build an application or website that fosters the radical features of Laravel 5.8 then, you must hire Laravel developer who holds a profound knowledge of these updates. A skilled Laravel developer will also adopt other new tools and techniques to boost the development process. What else do you wish for?

About the Author

I am a content specialist, with intensive experience in writing Technical Blogs. My knowledge about technologies and the latest mobile development practices is evident through my writings. I creates content that is purely informative.

Rate this Article
Leave a Comment
Author Thumbnail
I Agree:
Comment 
Pictures
Author: Dashmeet Kaur

Dashmeet Kaur

Member since: Mar 13, 2019
Published articles: 6

Related Articles