Skip to content

Generate Laravel Nova admin panels at light speed with GPT-4.

License

Notifications You must be signed in to change notification settings

smousss/laravel-novalize

Repository files navigation

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;

use 

class 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