A week before writing this, I found myself needing an interface and backend logic to manage eloquent models. With Nova, since it’s a composer package, you can install it in an existing Laravel 5.6 project that you’ve already built. That’s amazing if you think about it, it means that you don’t need to start over in order to integrate resource management into your app.
The frontend of Nova is a beautiful single page application powered by Vue.js, Vue Router, and Tailwind. Not only does Nova look great, it’s highly customizable.
To give you a quick overview, at a high-level Nova offers:
- Resource Management
At the heart of Nova is resource management: the ability to create, read, update, and delete resources. Not only does Nova cover basic resource management, it also covers things like updating data on things like polymorphic relationships.
Each eloquent model in your project will have a corresponding Nova resource which defines fields, actions, filters, lenses, and cards. Nova does not store any configuration in the database, it is configured using simple PHP classes.
Nova has basic field types as well as custom types like Markdown, Trix, Code, and Place.
Nova includes search functionality using SQL queries by default, and also seamlessly integrates with Laravel Scout if your application leverages scout.
Another area where the search is really cool is when you are creating a resource, that belongs to another model, Nova provides a search input to quickly find the related model.
Actions, Filters, and Lenses
Actions are simple PHP classes performing a task on resources. For example, if you wanted the ability to deactivate a user, you could define an action and trigger it from the UI on one user or a batch of users. If a model is marked with an
Actionable trait, Nova provides an audit trail of the actions performed against that model and tracks who triggered the action.
Filters allow you to scope resources for index queries on things like “active users” or “suspended accounts.” Similar to actions, filters are defined as simple PHP classes that enable you to scope your queries with the query builder. The filters are available from the index view of a given resource as well as when displayed as a relationship.
Finally, lenses allow you to build different views for a resource with full control over the underlying query and fields returned. When lenses are defined and attached to a resource, they can be used on a resource’s index page.
Nova ships with three standard metrics: value, trend, and partition. The built-in metric functionality makes it really easy to generate metrics. For example, you could track the number of new users created in your application for the current quarter compared to last quarter.
Once a metric is defined on a resource, it’s available from the index of the resource view. You can also create trends very easily leveraging the underlying Nova trends logic, and you can display them in various increments such as minute, hour, week, or even month.
Nova integrates with Laravel policies, and you have granular control over how is allowed to manage resources. When an Eloquent model has a policy, Nova uses it to authorize resource actions. You also have full control over which users can attach resources together via relationships.
We’ve only touched on high-level features and would encourage you to watch Talor’s presentation on the intricate details of using Nova to craft your next administration experience. For the level of flexibility it provides, the cost of Nova is a no-brainer.
Check out Nova at nova.laravel.com. Congratulations to Taylor Otwell (and everyone involved) for such an amazing product!