dekmabot/laravel-novable-resource

The laravel resource trait to auto generate laravel nova CRUD grids

0.1.1 2022-05-22 10:28 UTC

This package is auto-updated.

Last update: 2025-07-04 16:57:25 UTC


README

This trait helps to make laravel nova CRUD interfaces in one string.

<?php

namespace App\Nova;

use App\Models\User;
use NovableResource\Traits\NovableResource;

class UserResource extends \Laravel\Nova\Resource
{
    use NovableResource;

    public static $model = User::class;
}

When generating Nova Resource, you need to describe all fields for each model. And it`s a bit boring.

If you have already described it once in $casts array of the original Model, you do not need to describe it manually again. Just use this trait to automatically use all fields and relations to make CRUD interfaces for model with only one string.

Installation

composer require dekmabot/laravel-novable-resource

Usage

This trait allows you to automatically use these casted fields:

  • boolean
  • date
  • datetime
  • double
  • float
  • real
  • integer
  • string
  • timestamp

... and relations:

  • BelongsTo