smousss/laravel-novalize

Generate Laravel Nova admin panels at light speed using GPT-4!

0.1.7 2023-04-26 17:32 UTC

This package is auto-updated.

Last update: 2024-04-26 19:25:26 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Novalize

Create Laravel Nova admin panels at light speed!

Smousss generates Laravel Nova resources in a few seconds using GPT-4 to help you speed up your admin panel's development.

namespace App\Nova;

useclass Post extends Resource
{
    public static $model = \App\Models\Post::class;

    public static $title = 'title';

    public static $search = [
        'id', 'title', 'slug', 'content', 'description',
    ];

    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),

            BelongsTo::make('User'),

            Text::make('Title')
                ->rules('required', 'max:255'),

            Slug::make('Slug')
                ->from('Title')
                ->rules('required', 'max:255')
                ->creationRules('unique:posts,slug')
                ->updateRules('unique:posts,slug,{{resourceId}}'),

            Textarea::make('Content')
                ->rules('required'),

            Textarea::make('Description')
                ->rules('required'),

            HasMany::make('Comments'),

            BelongsToMany::make('Tags'),

            HasMany::make('Pins'),
        ];
    }
}

Installation

Install the package via Composer:

composer require smousss/laravel-novalize

Publish the config file:

php artisan vendor:publish --tag=novalize-config

Usage

  1. First, generate a secret key on smousss.com.
  2. Add it to your SMOUSSS_SECRET_KEY environment variable.
  3. Then, create a Nova resource based on your Post model: php artisan smousss:novalize App\\Models\\Post. Or for multiple models: php artisan smousss:novalize App\\Models\\Post App\\Models\\Comment

Credit

Novalize for Laravel has been developed by Benjamin Crozat for Smousss (Twitter).

License

MIT