Start a Project

How to upgrade to Laravel 6.x from 5.8 ?

The new Laravel 6.0 is a LTS release and  continues the improvements made in Laravel 5.8 by introducing semantic versioning, compatibility with Laravel Vapor, improved authorization responses, job middleware, lazy collections, sub-query improvements, the extraction of frontend scaffolding to the laravel/ui Composer package, and a variety of other bug fixes and usability improvements.

Some new features in the incoming 6.0 version are:

PHP 7.2 + required

Support for PHP 7.1 will end from December 2019 . Therefore, Laravel 6.0 requires PHP 7.2 or greater.

Updating Dependencies

Update your laravel / framework dependency to 6.0 in your composer.json file.

Next, examine any 3rd party packages consumed by your application and verify you are using the proper version for Laravel 6 support.

Carbon 2.0

Upgrade the Carbon 1.0 to Carbon 2.0. Laravel 6 does not support Carbon 1.0 anymore.

Database

The capsule table Method 

The signature of the Illuminate\Database\Capsul\Manager class’ table method has updated to accept a table alias as its second argument. If you are using illuminate/ outside of a Laravel application, you should update any calls to this method accordingly:

The cursor method

In the laravel 6, The cursor method now returns an instance of Illuminate\Support\LazyCollection instead of a Generator The LazyCollections may be iterated just like a generator:

Requests

The Input facade

The Input facade, which was primarily a duplicate of the Request facade, has been removed. If you are using the Input::get method, you should now call the Request::input method. All other calls to the Input facade may simply be updated to use the Request facade.

Authorized Resources & viewAny

Authorization policies attached to controllers using the authorizeResource method should now define a viewAny method, which will be called when a user accesses the controller’s index method. Otherwise, calls to the index method of the controller will be rejected as unauthorized.

Storage

URL Generation

In previous releases of Laravel, passing associative array parameters to the route helper or URL::route method would occasionally use these parameters as URI values when generating URLs for routes, even if the parameter value had no matching key within the route path.

For example, consider the following route:

This  change affected The action helper and URL::action method

Validation

FormRequest validationData Method

The form request’s validationData method was changed from protected to public. If you are overriding this method in your implementation, you should update the visibility to public.

String & Array Helpers

All str_ and array_ helpers have been moved to the new laravel/helpers Composer package and removed from the framework.

To replace these helpers to must use the Illuminate\Support\Str and Illuminate\Support\Arr classes

Source: https://laravel.com/

Hope it will be helpful for you. If you have any issue feel free to raise a ticket at https://bagisto.uvdesk.com/en/

Exit mobile version