Add Nova Composer Repo0:00
Now, you would be completely forgiven for thinking, look, this is a Laravel package. Now, can I not just run composer require laravel/nova? If you run that, you will actually run into an error, and that's because Nova is a paid product. It uses Composer, but it's not stored on packagist.org. So we have to tell Composer about a new repository that holds Laravel Nova. Thankfully, that's pretty simple. Jump into your project, head into the composer.json file, and at the bottom, we're going to add a new node called repositories. Repositories is an array that expects a single object. The type is going to be Composer. This is a new Composer repository we're pointing Composer to, and the URL needs to be https://nova.laravel.com. With that in place, if we, again, run composer require laravel/nova, installation will take place as expected, because Packagist will say, I don't have a package called laravel
Install With Credentials0:57
With that in place, if we, again, run composer require laravel/nova, installation will take place as expected, because Packagist will say, I don't have a package called laravel/nova, but nova.laravel.com will say, well, I do, so we'll use that one. However, you'll see that things have stopped because it's expecting a username and password. The username is equivalent to whatever username, whatever email address you signed up to Laravel Nova with. I'll use luke@laracast.com here, and the password will be your license key. Once you've entered that information, the installation will continue as normal and all of your dependencies will be installed. Now, of course, you may say, well, isn't that going to be frustrating, having to enter an email and license key every single time I want to run composer update? You're absolutely right. Don't worry, Composer has you covered. Let's
Store Credentials in auth.json1:39
to be frustrating, having to enter an email and license key every single time I want to run composer update? You're absolutely right. Don't worry, Composer has you covered. Let's create an auth.json file that will allow us to maintain that information so that Composer doesn't ask us each and every time. From the command line, type composer config, and then the following information, http-basic, that's because we're using http-basic-auth for this, followed by the domain, nova.laravel.com, then a space, followed by the email that you signed up for Nova with, and then your license key. With that information entered, inside your project, you'll note that we have a new auth.json file, and that auth.json file contains all of that information. The next time we run composer update, Composer's going to say, is there an auth file I can use for this? It will find this file, and it won't
Run Nova Install Commands2:23
contains all of that information. The next time we run composer update, composer's going to say, is there an auth file I can use for this? It will find this file, and it won't prompt you for the credentials. So I recommend doing that as soon as possible. It will save you lots of time in the long term. Now that composer has finished installing, we can run the artisan commands that will allow Nova to actually publish itself into our project. We'll start with php artisan nova:install. You'll note that it publishes and generates a few files. Amongst those files are migrations that we need to run. So php artisan migrate, and once we've executed those migrations, assuming your database is set up, Nova should actually be configured and ready for us to use. We'll make sure that's the case by jumping into our project and going to the /nova endpoint. If a login screen like
Log Into Nova Dashboard3:07
actually be configured and ready for us to use. We'll make sure that's the case by jumping into our project and going to the forward slash /nova endpoint. If a login screen like this loads, you know that things have gone well. If not, pop a comment in and I'll see if I can help you debug. In local development, you can actually enter any email address in your users table along with the password to log in. Don't worry, that's only in local development. We'll talk about how you can configure access for production a little later down the line. But for now, I know that I have a User called Luke at laracasts.com and the password is password. If I enter that information, I'm taken to the Laravel Nova dashboard where I already see a beautiful administration panel ready for me to configure. Just to go over a few of the features, we have the ability to go between light and dark
Review UI and Customize3:49
dashboard where I already see a beautiful administration panel ready for me to configure. Just to go over a few of the features, we have the ability to go between light and dark mode that's built in out of the box. And we can also use the system mode. So if it gets past a certain time on Mac OS, it will move automatically into dark mode. I have a notification tray which we'll come back to. The dropdown allows me to log out here. I'm given information to links for various parts of the Nova ecosystem and it's already set up for me, my User resource based on the users table and model. You can see here is the user I have currently logged in as. So we have a great head start, but this is very Nova-y, right? We have the Laravel Nova logo up here. That's not my logo and it's using this blue color scheme. But if I go back to the homepage, I have a green color scheme. It would be nice if I could
Laravel Nova logo up here. That's not my logo and it's using this blue color scheme. But if I go back to the homepage, I have a green color scheme. It would be nice if I could blend Nova in with my application a little so that it looks a little bit more like I created it. Don't worry, you can do that very easily using a few customization options that Nova provides. So in the next episode, why don't we take a look at customizing Nova to fit our theme and style.
