onlinecode

Laravel 6 Release New Features and Upgrade

Laravel 6 Release New Features and Upgrade

In this post we will give you information about Laravel 6 Release New Features and Upgrade. Hear we will give you detail about Laravel 6 Release New Features and UpgradeAnd how to use it also give you demo for it if it is necessary.

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.

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 IlluminateSupportStr and IlluminateSupportArr 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 “IlluminateSupportLazyCollection” 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:

Also see:Laravel 6 Authentication Tutorial

/**

* 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…

Hope this code and post will helped you for implement Laravel 6 Release New Features and Upgrade. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Exit mobile version