Jetstream v2 Overview0:00
Okay, let's take a look at Jetstream version 2. So v2 was released right as this series was published, so the timing was a bit unfortunate because I recorded everything in version 1. Luckily, there aren't any major changes, so let's go ahead and go through them. So first, if you're coming from version 1, then be sure to check out the upgrade guide, which you can find here. I'm not going to go through this here, but the steps are pretty self-explanatory. And if you're installing a fresh app with Jetstream, you're already going to get version 2 by default. So I have an app here with version 2 of Jetstream installed, so let's go ahead and take a look.
Terms & Privacy Pages0:56
So if we go to the register page, you'll see a page for terms and privacy policy and a checkbox here. So you have to check this in order to register as a new User. So let's take a look at the terms page. There's the default terms page, and same thing for privacy policy. So let's look for that in the code. So let's go down to views, and I am using the Livewire version here, and you can see a page for terms and policy. So if you look, you'll see that there's this terms variable, and same for privacyPolicy. So how do we populate that?
So if you look, you'll see that there's this terms variable, and same for privacyPolicy. So how do we populate that? So just to show you this is a correct page, policy here, and this should be updated, okay? And if you want to update this variable, you can find it within the Markdown folder here, and there's one for policy, and there's one for terms. So just edit this in Markdown, and it should work. Hello there. Do the same for terms. New terms, okay? And this should be updated, and it is.
Team Email Invites2:59
email invites. So before, we would just add the user's email here, and this user already had to be within the application, or this user already had to have an account. With this new feature, they don't have to have an account, and the email will instruct the user to create one if they don't have one. So this is on by default if you have Teams enabled. So again, let's go to Jetstream. And here it is. Invitation is true. So if you want it to work like before, just remove this or set it to false.
Invitation is true. So if you want it to work like before, just remove this or set it to false. But let's take a look at the email that gets sent out. So I already have my mailer set up. So it's using this hello client. Actually, I don't have it open, so let me open that. So yeah, it should be set up in my Laravel app, so we should get an email. So let me add a User that doesn't exist. And let's just say editor, and we should get an email. And my notification didn't show, but I do have an email here.
Running Feature Tests4:45
You have accepted the invitation and are now a part of Andre's team. So again, we have this new team's menu here. And we can toggle between the two different teams that we're on now. So Andre's team and my default team here. And the last feature that was added, which is my favorite, is the addition of feature tests within your application. So if you go to tests down here, you'll see a bunch of feature tests that make sure that Jetstream is working correctly. So similar to the tests in Breeze, but now they are here for Jetstream as well. So let's go ahead and run these tests.
So similar to the tests in Breeze, but now they are here for Jetstream as well. So let's go ahead and run these tests. Make sure to update my phpunit.xml. And let's just set it to SQLite. And let's go ahead and run these tests. We can do phpunit, or I'm going to do php artisan test. So the tests are running and they are passing. And there is a failure there. So what's going on there? So it's failed in RegistrationTest.
Fix Registration Test5:41
So what's going on there? So it's failed in registration test. So let's take a look at that. registration test. And it's registering to the register route. But since I turned on the feature for the terms, like I showed you earlier, then I think it's not taking that into account. So let me comment this out. And let me try running this one test here. And it should pass now.
And let me try running this one test here. And it should pass now. And it does. So yeah, that case was not handled correctly. So let's just double check that again. If I comment this back in, this should fail now. Let's run it again. It should fail. And it does. So let's quickly fix that.
And it does. So let's quickly fix that. So I think we have to add a terms field here, because that's the name of the checkbox. So let's go ahead and look at that. Let's log out here. Register. And this field name is terms. And this should get passed through if the feature is on. Where is it?
And this should get passed through if the feature is on. Where is it? Yeah, it's this terms checkbox right here. So we can just check for that here. You can do terms. And we can check if the feature is on like this. So Jetstream has terms and privacy policy feature. And if it's on, then we'll just pass anything through. Let's say on. And if it doesn't, just pass it through null.
Let's say on. And if it doesn't, just pass it through null. And you have to make sure to use this class. I don't have the plugin installed. So let me just use it up here. It's Laravel Jetstream. Jetstream, I believe. OK, so let's see if this passes now. So let's run this test again. And it does pass.
So let's run this test again. And it does pass. So let's make sure the case when it's off works as well. Let's run that test again. And it does pass. So yeah, I'll make sure to PR that into the Jetstream repo on GitHub. So yeah, those are the major changes in Jetstream V2. So go ahead and use it in your new applications.
So go ahead and use it in your new applications.
