Reviewing Upgrade Changes0:00
Alright, so fingers crossed, but if you'd like, why don't you come along as I upgrade the Laracasts codebase itself to version 8. Right now, let's see, I'm on version 7.5. So yeah, who knows, we'll see how long this takes, but why don't we dig in. Now, you'll see that the updates here are split into high-impact and medium-impact changes. Basically what you'll find is most of the medium and small ones often won't affect your codebase at all. So we'll start with ModelFactories. So as you know at this point, Laravel 8 has removed the factory function and they've switched over to class-based ModelFactories using the hasFactory trait on your model.
So as you know at this point, Laravel 8 has removed the factory function and they've switched over to class-based ModelFactories using the hasFactory trait on your model. So if we don't want to update all of my tests, and I don't right now, we can pull in legacy factory support. So I'll do that now. And I'm not sure, maybe that could be a dev release. Let's just leave it like that. All right, anyways, let's keep going. QueueRetryAfter method has been renamed. I don't think I use that ever, so I can skip that.
QueueRetryAfter method has been renamed. I don't think I use that ever, so I can skip that. QueueTimeout property, I don't use that. Pagination defaults, so it now uses Tailwind for its default styling. And if you want to continue using Bootstrap, and you know what, I think I can skip this because I've been using custom pagination styling for a while now. So it shouldn't be too bad for the high-impact changes. Let's keep going. Medium-impact changes, 7.3 required. We should be good on that front, 7.4, and I believe that's the same on my production.
Updating Composer Dependencies1:28
Medium-impact changes, 7.3 required. We should be good on that front, 7.4, and I believe that's the same on my production server. Okay, next step, we need to update our dependencies. I'm going to go to composer.json. We'll bump framework to 8. And then, let's see, collision to 5. What else? Guzzle to 7.0.1. And then, ignition to 2.3.6.
Guzzle to 7.0.1. And then, ignition to 2.3.6. Now that's just for the first-party packages. I'd have to go through some of these and see if I need to update them. For example, this is the old HTML and Laravel Collective package. In fact, I'm not even sure if I use it anymore. It's probably in one or two views, and I just need to get rid of that. But let me have a look here, laravelcollective/html. Okay, so they do have a Laravel 8 release, and it looks like we want 6.2. So let's update that here.
Okay, so they do have a Laravel 8 release, and it looks like we want 6.2. So let's update that here. What else here? I think bug snag Laravel is going to be an issue. Let's see. Bug snag, bug snag, Laravel. Hmm, yeah, so this is often the case when you're upgrading pretty early. It looks like they do not have Laravel 8 support yet, but a couple issues, which means it could probably be tagged any day now. So we'll see if that's going to be a problem, but I bet it is.
probably be tagged any day now. So we'll see if that's going to be a problem, but I bet it is. Anyway, so let's keep going. Laravel Nova, I'll take care of behind the scenes. Yeah, at least that's a first stab. So let's keep going. I'm not using any of these. I've already updated the Laravel installer in episode 1 of this series. So let's keep going. We've taken care of that.
Resolving Composer Conflicts3:44
Send now. Yeah, I'm going through this very quickly. Elixir is deprecated. I don't think most of this is going to affect me. Yeah. Okay, so why don't we run a composer update and see how we do. Ah, it fails. Yep, I got bit by that bug snag, Laravel. So in these situations, what should we do? Of course, I could wait a couple of days, and usually that's what you should do.
Forking Bugsnag for L84:05
So in these situations, what should we do? Of course, I could wait a couple of days, and usually that's what you should do. Hmm. Now, to be honest, I normally wouldn't do this. But for the video, I'm going to temporarily fork this repo. I will use the forked version with Laravel 8 support, and then once they tag a release, I will jump back. But yeah, if I weren't recording a video, I would realistically just wait. Okay, so let's see if we can just inline edit this, because often, I'm not sure, but my guess is to support Laravel 8, we only need to bump the illuminate dependencies.
Okay, so let's see if we can just inline edit this, because often, I'm not sure, but my guess is to support Laravel 8, we only need to bump the illuminate dependencies. So for example, we could just say, also get version 8, and the same here. Fingers crossed, but I think that might be it. And actually, let's create a new branch, L8 for Laravel 8. And now in this case, I don't care about the PR. Okay, so now we do have a Laravel 8 branch here, where we've updated... Where is it? Where we've updated the dependencies. Okay, so now how can I say in my own project that in place of...
Where we've updated the dependencies. Okay, so now how can I say in my own project that in place of... Where is it? Bugsnag. In place of this, I actually want to use my forked version. Here's how. We're going to begin by not using 2.0, but the dev version, and the branch name was L8. Okay, next we'll go down to the repository section here, and let's add a new one. So this will be type of version control VCS, and the URL will be the URL to that repo I just forked. And I think that should do it.
So this will be type of version control VCS, and the URL will be the URL to that repo I just forked. And I think that should do it. So now we're telling Composer for that Bugsnag Laravel project, this is actually what I want you to pull from, and then within it, I want you to grab the L8 branch. Okay, so with any luck, if I run this again, it should work. At least I hope so. And it still fails, but at least we've changed the error. So we have an issue with, hmm, Guzzle. Oh, but actually maybe it's Postmark. So we're trying to pull in Guzzle 7, but I also have this package for Postmark,
Fixing Postmark Guzzle Version6:05
Oh, but actually maybe it's Postmark. So we're trying to pull in Guzzle 7, but I also have this package for Postmark, and that wants to pull in Guzzle 6. So you see the issue there. So let's see, this is yet another case. It looks like they have a PR. Hmm, do I want to do it again? This is what I mean. Often, it's just easier to wait even a week, and then you're good to go. But I want to get this done for you.
Let's do it. Check out that callback there. So yeah, if nothing else, it's a good refresher for how to handle situations like this, even if it's only temporary, like in this case. So let's edit the file. Add Guzzle 7 support. Commit it to a new branch called L8 again. All right, so this is all a recap now. Dev L8, and then finally, at the bottom, I can add one more here, where I will update this to that forked repo.
Running Tests and Finalizing7:43
and then run your full test suite. So fingers crossed, this works now. And I'm actually going to ignore any third-party Stripe-type tests. Okay, wow, it worked. That's good news. So now, as a sanity check, I would still do some manual testing, just to make sure everything works the way I expect. You get the idea. And I'm not going to make you watch that. But then, once I'm comfortable, I would go ahead and make my Laravel 8 commit.
And I'm not going to make you watch that. But then, once I'm comfortable, I would go ahead and make my Laravel 8 commit. So after that, you can then do any optional upgrades you want. For example, maybe I do want to run php artisan schema:dump --prune to trim down my migrations file. I probably will do that. Maybe I want to switch over to the models directory. That's another optional upgrade I can perform. But yeah, other than that, I think we're ready to go.
