First Step to Laravel Nova
Laravel Nova is the latest addition to the Laravel creations, it is an administration panel crafted by the Laravel creators. If you are new to Laravel Nova, then this blog can help you know the process of starting with it, step by step.
For Laravel Nova, the first thing you need to start with, is, going to Nova’s website and registering for an account. Once you complete the registration formalities, you can move forward with purchasing a license which is used to download the Nova zip files.
- Install Laravel
Moving forward, you need to install laravel 5.6 or greater by using composer create-project command in your terminal:
For example; I will be creating here a laravel project named ‘learnnova’ using the following command;
composer create-project laravel/laravel learnnova
- Add Nova Folder to Your Project
You can also add Nova to existing Laravel projects which meets the prerequisites for Nova installation. Unzip the contents of the downloaded zip file into a nova directory, inside the project root.
Once you have unzipped the source code, you need to add the following configuration to the composer.json
Next, add laravel/nova to the require section of your composer.json.
After updating your composer.json, update composer using the following command in the terminal.
- Configure your DB and install nova
Make sure you configure your DB in your .env file, before running the following commands in your terminal to install Nova.
php artisan nova:install
php artisan migrate
Note that App\Providers\NovaServiceProvider would be automatically added to the providers array in config/app.php. If it isn’t, you need to add it manually.
Serve your project using the following command in your terminal:
php artisan serve
Now, you can navigate to http://127.0.0.1:8000/nova/login, to see the login screen.
Create your first User
Laravel Nova provides you with an out-of-box command to create your first user. You can use the following command in your terminal and follow the prompts. However, before creating the user, you need to configure your database.
php artisan nova:user
By using the gate method in app/Providers/NovaServiceProvider.php file, you can control the access to Nova. You can freely modify it to restrict the access.
It is just the beginning of Laravel nova, a process of installation. More is yet to come, where you can see what all we can build up with Nova.
So, to keep learning, check out the next post soon!!