Laravel 6 Release New Features and Upgrade

Laravel 6 Release New Features and Upgrade

Laravel introduce new version documentation with Laravel 6 new features and upgrade guide. Still not give access of code but as soon as it will be available. Laravel 6 gives new feature and some modifications from Laravel 5.8.

Originally published by Hardik Savani at https://itsolutionstuff.com

Some of big new feature I will list here so it can help you when you start using Laravel 6 version.

Let's see some new feature from Laravel 6 website listed:

1) String & Array Helpers Moved To Package

Laravel 6 have been removed all str_ and array_ helpers functions from by default. Laravel 6 introduce new composer package for string and array helpers function. helpers can use the Illuminate\Support\Str and Illuminate\Support\Arr classes.

If you want to use array and string helpers in Laravel 6 then you need to use following composer package for helper.

composer require laravel/helpers

2) Carbon 2.0 Supported

In Laravel 6, they removed Carbon 1.x version of carbon and they added Carbon 2.0 in Laravel 6. So you can read Carbon 2.0 documentation what they added new.

You can read from here: Carbon 2.0.

3) Added cursor method in Eloquent

Laravel 6 added new database eloquent method as cursor(). using cursor() method it will return "Illuminate\Support\LazyCollection" instance.

You can use as like bellow:

$posts = Post::cursor();

foreach ($posts as $post) {

}

4) Update on Eloquent BelongsTo::update Method

In Laravel 6, they give mass assignment protection on belongs to update method. When we are using relation with belongs to then we can update using function. But they not provide mass assignment protection.

In this upgrade, it will provide mass assignment protection. You need to use as like bellow:

/* Without mass assignment protection */
$book->author()->update(['name' => 'Hardik']);

/* With mass assignment protection / $book->author->update(['name' => 'Hardik']);

5) Declaration Of Primary Key Type

Laravel 6 made this update because of it's improve performance optimizations using set primary key on your model. So basically, if you are using string column data type with primary key then you need to set it on your model as like bellow:

/*

  • The "type" of the primary key ID.
  • @var string
  • / protected $keyType = 'string';

I listed that was good updated.

You can also checkout more upgrade from here: Laravel 6.0 Upgrade

I hope it can help you...

Thanks for reading

If you liked this post, share it with all of your programming buddies!

Follow me on Facebook | Twitter

Further reading

PHP with Laravel for beginners - Become a Master in Laravel

Projects in Laravel: Learn Laravel Building 10 Projects

Laravel for RESTful: Build Your RESTful API with Laravel

Fullstack Web Development With Laravel and Vue.js

Laravel 5.8 Tutorial for Beginners

Laravel 5.8 Ajax CRUD tutorial using Datatable JS

Laravel 5.8 Tutorial from Scratch for Beginners

Build RESTful API In Laravel 5.8 Example

Login with Google in Laravel 5.8 App using Socialite Package

Laravel PHP Framework Tutorial - Full Course for Beginners (2019)

Upgrading Laravel To 6.0 From 5.8

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[https://www.dataeximit.com/php-development-services/](https://www.dataeximit.com/php-development-services/ "https://www.dataeximit.com/php-development-services/"), we at Data EximIT have...

Advantages of Hiring PHP Developer for your Website Project

PHP - Hypertext pre-processor, a scripting language used by many people in developing web pages, but most of us are unaware even of the full form. To train someone and make them learn this whole language is as difficult and time-consuming as it is...

Hire PHP Developer and Web Developer for your Online Business

PHP is widely used open-source scripting language it helps in making dynamically easy your websites and web application. Mobiweb Technology is your best technical partner and offering you solution for any kind of website and application...