How to create an admin panel with Laravel Nova

Vineeth Vijayan
Vineeth Vijayan
Published in
2 min readJul 4, 2020

Almost all web apps need a dashboard. And we developers make CRUDs for users, products, employees etc. Even thought the fields changes, we are doing repeating too many steps in the process. So the idea is to generalise those steps and code only the login which is unique to an entity. Laravel Nova is amazing contribution from Laravel.

Installation

Laravel Nova is a paid package, you need to pay $99 for a single license. Considering the advantages from Laravel Nova over developing it in custom, it worth the price.

You need to register and download Nova package as a zip file. Then unzip the contents and move those to a newly created folder named “nova” in the project root, not in public folder. Now we need to update composer.json file.

Also add laravel/nova in require section.

Then run the following commands:

composer updatephp artisan nova:install // Install Novaphp artisan migrate // Migrate tables of Novaphp artisan nova:publish // Publish Nova's public assets, views etcphp artisan view:clear // Clear cached views.

Congrats! The installation part is done.

Now lets start coding. We are assuming there are two tables, users table & posts table. In Nova everything is a resource or in other words, each CRUD is managed by a resource, so for Post model, we’ll create a PostResource class to manage its CRUD.

php artisan nova:resource Post // Create new resource

The the PostResource class there will be fields method like in the code below. In this method we mention the fields we need.

You are done. Now you have a CRUD for your posts table. Nova will create listing, edit, create and delete functionalities behind the scene. Yes, its almost like magic.

Now can login to any of your users from “https://example.com/login”, then access your Post CRUD from “https://example.com/nova”

Checkout the following UI’s of Laravel Nova to get an idea.

Users listing page
New post page

This is an introduction to your Laravel Nova journey, it has many type of fields, many ways to customise for our needs, Laravel relationships are very powerfully used in Nova. So what you think? It’s worth the time and money right? If you compare this with the hourly cost required to build an admin panel like this then, it would make sense.

Love this article? Click here to buy me a coffee :)

--

--

Vineeth Vijayan
Vineeth Vijayan

Software Engineer | Scribbler | Loves coding and movies | Passive Reader | Lazy Blogger