Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 6.x #11397

Merged
merged 12 commits into from
May 23, 2020
Merged

Laravel 6.x #11397

merged 12 commits into from
May 23, 2020

Conversation

Jellyfrog
Copy link
Member

This pull request includes the changes for upgrading to Laravel 6.x. Feel free to commit any additional changes to the shift-26000 branch.

Before merging, you need to:

  • Checkout the shift-26000 branch
  • Review all pull request comments for additional changes
  • Update your dependencies for Laravel 6
  • Run composer update (if the scripts fail, add --no-scripts)
  • Thoroughly test your application (no tests?)

If you need help with your upgrade, check out the Human Shifts. You may also join the Shifty Coders Slack workspace to level-up your Laravel skills.

@Jellyfrog
Copy link
Member Author

Jellyfrog commented Apr 8, 2020

❌ Shift could not upgrade the following files since they differed from the default Laravel version. You will need to compare these files against the default Laravel 6 versions and merge any changes:

  • app/Http/Kernel.php
  • resources/lang/en/validation.php

@Jellyfrog
Copy link
Member Author

Jellyfrog commented Apr 8, 2020

⚠️ Laravel 6.x consolidated references to /home as a constant within the RouteServiceProvider. This makes it easier to maintain and change in a single place.

Shift automated this change, but could not upgrade the following files since they differed from the default Laravel version. You should compare these files against the default Laravel 6 versions and merge this change:

  • app/Http/Controllers/Auth/LoginController.php

@Jellyfrog
Copy link
Member Author

Jellyfrog commented Apr 8, 2020

⚠️ Since you are upgrading from an older version of Laravel, Shift defaulted your customized configuration files to make future Shifts smoother. This was done in a separate commit so you may easily review and backfill your customizations once you are running the latest version.

  • config/auth.php
  • config/broadcasting.php
  • config/cache.php
  • config/database.php
  • config/filesystems.php
  • config/logging.php
  • config/mail.php
  • config/queue.php
  • config/services.php

@Jellyfrog
Copy link
Member Author

ℹ️ Laravel 6 changed the default Redis client from predis to phpredis. You may keep using predis by setting REDIS_CLIENT=predis for your environment.

However, if possible, consider switching to phpredis to gain the performance of its PHP extension and avoid using the deprecated predis dependency which will be removed in Laravel 7.0.

@Jellyfrog
Copy link
Member Author

ℹ️ Shift updated your dependencies for Laravel 6. While many of the popular packages are reviewed, you may have to update additional packages in order for your application to be compatible with Laravel 6.

Watch dealing with dependencies for tips on handling package incompatibilities.

@Jellyfrog
Copy link
Member Author

❌ Laravel 6 added the viewAny method to authorization policies attached to controllers. You will need to add the following method to your policies and update the logic. Otherwise calls your controller's index action will be rejected.

/**
 * Determine whether the user can view any model resource.
 *
 * @param  \App\User $user
 * @return mixed
 */
public function viewAny(User $user)
{
    return true;
}

@Jellyfrog
Copy link
Member Author

Jellyfrog commented Apr 8, 2020

⚠️ In Laravel 6, the update method of the BelongsTo relationship no longer provides mass assignment protection or fires Eloquent events. If you wish to preserve this behavior, you should call update on the model itself.

// no mass assignment protection or events...
$post->user()->update(['foo' => 'bar']);

// mass assignment protection and events...
$post->user->update(['foo' => 'bar']);

Shift found potential uses of the update method in:

  • app/Models/PollerGroup.php

@Jellyfrog
Copy link
Member Author

ℹ️ The Eloquent model's toArray() method will now cast any attributes that implement Illuminate\Contracts\Support\Arrayable to an array. While unlikely to impact your application, this change could effect code which relies upon the previous data type or output.

@Jellyfrog
Copy link
Member Author

ℹ️ Laravel 6 now requires Carbon 2. While Shift reviewed your application for common breaking changes, you may want to review the Carbon 2 migration notes for additional changes.

@CLAassistant
Copy link

CLAassistant commented Apr 8, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ Jellyfrog
✅ murrant
❌ laravel-shift
You have signed the CLA already but the status is still pending? Let us recheck it.

@Jellyfrog
Copy link
Member Author

Jellyfrog commented Apr 8, 2020

⚠️ Previous versions of Laravel would bind parameters passed to the URL helper methods as placeholder values even if the names mismatched. In Laravel 6, named parameters not matching placeholders are attached to the query string instead.

Shift detected the following route() and action() calls passing named parameters you should review to ensure they match the route placeholder name.

  • resources/views/user/edit.blade.php

@Jellyfrog
Copy link
Member Author

ℹ️ Laravel 6 made performance optimizations for integer key types. If you are using a string as your model's primary key, you may set the $keyType property on your model.

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

@Jellyfrog
Copy link
Member Author

ℹ️ The mandrill and sparkpost mail drivers, as well as the rackspace storage driver were removed in Laravel 6. If you were using these drivers, you may adopt a community maintained package which provides the driver.

@Jellyfrog
Copy link
Member Author

ℹ️ Previous versions of Laravel would retry jobs indefinitely. Beginning with Laravel 6, the php artisan queue:work now tries a job one time by default. If you want to force jobs to be tried indefinitely, you may pass the --tries=0 option.

@Jellyfrog
Copy link
Member Author

ℹ️ Shift noticed you have additional namespaces in your application. You should consider using the Consolidate Namespaces Shift to simplify your namespaces into the default Laravel App namespace.

@Jellyfrog Jellyfrog added Needs Testing Waiting for others to verify that the code functions properly. Needs-Notification Refactor labels Apr 8, 2020
@Jellyfrog Jellyfrog added this to the 1.64 milestone Apr 8, 2020
@Jellyfrog Jellyfrog changed the title Laravel 6.x Shift WIP: Laravel 6.x Shift Apr 8, 2020
@Jellyfrog
Copy link
Member Author

ℹ️ Laravel 6 made performance optimizations for integer key types. If you are using a string as your model's primary key, you may set the $keyType property on your model.

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

Do we have string primary keys anywhere?

@Jellyfrog Jellyfrog force-pushed the shift-26000 branch 6 times, most recently from 6e40575 to fcfe6ea Compare April 15, 2020 09:31
@Jellyfrog
Copy link
Member Author

Kinda depends on #11470, and also updating daily.sh with minimum php version

@Jellyfrog Jellyfrog force-pushed the shift-26000 branch 2 times, most recently from 782a143 to 9fbaa9b Compare April 24, 2020 14:04
@Jellyfrog Jellyfrog changed the title WIP: Laravel 6.x Shift Laravel 6.x May 12, 2020
@murrant murrant force-pushed the shift-26000 branch 3 times, most recently from 195ee96 to 4b38986 Compare May 23, 2020 01:31
@murrant murrant removed Needs Testing Waiting for others to verify that the code functions properly. Needs-Notification labels May 23, 2020
@murrant murrant merged commit b09bc07 into master May 23, 2020
@murrant murrant deleted the shift-26000 branch May 23, 2020 17:05
@murrant
Copy link
Member

murrant commented May 31, 2020

This pull request has been mentioned on LibreNMS Community. There might be relevant details there:

https://community.librenms.org/t/v1-64-release-changelog-may-2020/12290/1

@murrant
Copy link
Member

murrant commented Jun 11, 2020

This pull request has been mentioned on LibreNMS Community. There might be relevant details there:

https://community.librenms.org/t/users-get-redirected-to-login-page/12424/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants