در حال بارگذاری ...

Comparing JS Scaffolding0:00

Next up, we have some changes to the front-end scaffolding in Laravel. So here you can see I have side-by-side a fresh install of Laravel 5 and Laravel 6. So if we take a look at our resources/js/app.js file for Laravel 5, this is what you'd get. So among other things, it pulls in Vue, and then it registers an example component and the root instance. Next, the bootstrap file pulls in lodash, then popper, then jQuery, and then bootstrap. And in my opinion, it's a little heavy and maybe a little bit behind the times. Let's now take a look at what you get in Laravel 6. So I will go to the Laravel 6 folder and then resources/js/app.js. Now there's no reference to Vue or any JavaScript framework.

So I will go to the Laravel 6 folder and then resources/app.js. Now there's no reference to Vue or any JavaScript framework. And in fact, if I go to the package.json file, you'll see there's no reference to any of that. It's just some basic things you might want, like Axios, Laravel Mix, I think even lodash could go personally, but that's still there for the time being, and then a couple of things related to your build process. All right, so if we switch back, now the bootstrap file no longer pulls in jQuery, bootstrap, or popper, and it also removes some old code related to attaching a CSRF token, which we don't need.

Manual Asset Compilation1:09

or popper, and it also removes some old code related to attaching a CSRF token, which we don't need. Next, one other thing. If I go back to Laravel 5, out of the box we included the compiled assets for your convenience. Once again, that's no longer the case. In Laravel 6, you will need to do that manually. So your public directory is now nice and clean, and of course, all you would need to do is run npm install to download your dependencies, and then finally, npm run dev to compile those. Finally, one last thing. If I run php artisan, you'll see there's no longer a make-auth command, and this might

Auth Scaffolding Moved1:40

Finally, one last thing. If I run php artisan, you'll see there's no longer a make-auth command, and this might be confusing if you leveraged it a lot. But in Laravel 5, of course, you would see that right up here. So because this is considered part of your front-end scaffolding, it too has been removed, and all of it has been moved to a new Laravel UI package, and you can review that here. So if we take a look at the source directory, here's all of the original presets. Again, they've just been extracted out of the Laravel framework into a new package that can then be versioned separately from the framework. So it looks like we have view, react, and bootstrap presets, and if you still want those,

Installing Laravel UI2:15

can then be versioned separately from the framework. So it looks like we have view, react, and bootstrap presets, and if you still want those, here's how you do it. Let's pull it in. composer require laravel/ui. Great. Now, if I run my php artisan command, you'll see, for one, we have a new ui-auth command, so this is basically the same as make-auth. There you go. But also, if we scroll up, we have a top-level ui command.

Running UI Presets2:40

There you go. But also, if we scroll up, we have a top-level php artisan command. So let's take a look at that, php artisan help ui, and here's where we can provide the preset we want. So if I want to pull back in view support, I would say php artisan ui view, and then if you want to add the auth scaffolding in the process, you could add that there. Alright, let's run it, and we should be all set to go. So now, back in my Laravel 6 project, if I go to package.json, you'll see, once again, it pulled back in the view dependencies we require, and then if we go to the app.js file, you'll get what you're typically used to from a fresh Laravel 5 install.

it pulled back in the view dependencies we require, and then if we go to the app.js file, you'll get what you're typically used to from a fresh Laravel 5 install. And that'll do it.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟