New Models Directory0:00
First up on our journey is the new models directory. But first, notice that I do have two installations of Laravel installed. One for version 7, and one for version 8. This way we can easily contrast what has changed. Okay, so starting with version 7, out of the box, the User model is directly in the app namespace. And this is fine, no problems, but in version 8, you'll now find a new models directory. And this is where your default User will rest. Now a quick note, if you're upgrading to version 8, you don't have to change anything if you don't want to.
Auto-Detect Model Location0:33
Now a quick note, if you're upgrading to version 8, you don't have to change anything if you don't want to. Everything will still work. However, notice, if I switch to Laravel 8, and we run that same command, it will now be added, of course, to the models directory. But on that note, have a look. If I were to delete that, the way it works behind the scenes, let's just bring this back. Let's assume you don't like the models directory for some reason. You're going to update your code for User to return where it was before. Well now, Laravel is going to detect that whenever you generate a model.
Restoring Models Directory1:00
You're going to update your code for User to return where it was before. Well now, Laravel is going to detect that whenever you generate a model. It'll see, hmm, there's no models directory, so let's just throw it into the app folder, as you see here. And that's it. A small change, but you wouldn't believe how many people have wanted this. So let's go ahead and return to what we had earlier, bring back the models directory, and in the next episode, we'll squash some migrations.
