Code Monkey home page Code Monkey logo

nova-grid's Introduction

#Based on this package that was dropped by the author https://packagist.org/packages/jobcerto/nova-grid

Grid Layout tool for Laravel Nova

This is a tool for Laravel's Nova administrator panel that allows you to create grids-based-layout for your resources.

Installation

You can install the package via composer:

composer require nibri10/nova-grid

Then, you will need to register the tool within the NovaServiceProvider.php:

use Nibri10\NovaGrid\NovaGrid;

...

/**
 * Get the tools that should be listed in the Nova sidebar.
 *
 * @return array
 */
public function tools()
{
    return [
        // other tools
        new NovaGrid,
    ];
}

Using this tool

  • After set the tool, all your fields now have access to an meta property size and the value is any of tailwind classes for sizes.

EXAMPLE

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

            Text::make('Name')
                ->size('w-1/3'),

            Select::make('Type')
                ->size('w-1/3')
                ->options(UserType::toSelectArray()),

            Text::make('Email')
                ->size('w-1/3')
                ->sortable()
                ->rules('required', 'email', 'max:254')
                ->creationRules('unique:users,email')
                ->updateRules('unique:users,email,{{resourceId}}', 'sometimes'),

            Password::make('Password')
                ->size('w-1/3')
                ->onlyOnForms()
                ->creationRules('required', 'string', 'min:6')
                ->updateRules('nullable', 'string', 'min:6', 'sometimes'),

            InlineSelect::make('Status')
                ->size('w-1/3')
                ->options(Setting::userStatuses())
                ->inlineOnIndex()
                ->fillUsing(function ($request, $model) {
                    $model->applyStatus($request->status);
                }),

            BelongsTo::make('Office')
                ->size('w-1/2')
                ->nullable(),
        ];
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.