Laravel Nova — Simple CRUD

Renato Silva
2 min readApr 28, 2022

--

In this article i’m gonna show you how to implement a simple CRUD using Laravel Nova 4.

Before we start, i suppose you know the basics of laravel, so we gonna start a new project.

Remember: The license needs to be purchased in https://nova.laravel.com/

1. Instalation

Open the command prompt and create a new laravel project using composer.

composer create-project laravel/laravel app-name

After you created the project, edit the file composer.json and add this line of code.

In require section add this line.

Run this command

composer update - - prefer-dist

The prompt will ask for username and password, the username is the e-mail used to buy the license and password is the key license of nova.

Now run this commands.

php artisan nova:install

php artisan migrate

php artisan storage:link

And create a user to login into application. The default route for login is localhost:8000/nova but you can change this in config/nova.php path.

php artisan nova:user

2. Migrations and Model

Let’s create one model with migration using the command.

php artisan make:model Team - - migration

Edit the migration file.

And run php artisan migrate.

3. Nova Resource

Run the command php artisan nova:resource Team

Edit the file App/Nova/Team.php

In my project i was using lang files, you can create in respective folder or just use a normal name, the first parameter is the name will appear in label and the second parameter the name of field in database.

Don’t forget to import Text and Image from Laravel\Nova\Fields.

With these fields we gonna save infos in database and images in public/storage folder.

Soo Easy!

I hope this tutorial will be useful to someone. :)

--

--

Renato Silva

I’m a Brazilian Web Developer. Work at Koi Systems.