All Projects → eminiarts → Nova Tabs

eminiarts / Nova Tabs

Laravel Nova Tabs Package

Projects that are alternatives of or similar to Nova Tabs

Nova Repeatable Fields
A Laravel Nova field for configuring repeatable sets of fields
Stars: ✭ 126 (-52.45%)
Mutual labels:  laravel, nova
Laravel Nova Localizations
🌎 Localization files for Laravel Nova
Stars: ✭ 161 (-39.25%)
Mutual labels:  laravel, nova
Nova Settings Tool
Laravel Nova tool to view and edit application settings.
Stars: ✭ 131 (-50.57%)
Mutual labels:  laravel, nova
Nova Indicator Field
A colour-coded indicator field for Laravel Nova
Stars: ✭ 108 (-59.25%)
Mutual labels:  laravel, nova
Skeleton Nova Tool
A skeleton repository for Spatie's Nova Packages
Stars: ✭ 191 (-27.92%)
Mutual labels:  laravel, nova
Nova Tail Tool
A Laravel Nova tool to display the application log
Stars: ✭ 110 (-58.49%)
Mutual labels:  laravel, nova
Nova Cashier Manager
Managing Stripe subscriptions inside the incredible Laravel Nova admin panel.
Stars: ✭ 150 (-43.4%)
Mutual labels:  laravel, nova
Nova Advanced Image Field
🌄📐 A Laravel Nova advanced image field with cropping and resizing using Cropper.js and Intervention Image
Stars: ✭ 67 (-74.72%)
Mutual labels:  laravel, nova
Nova Filemanager
A Filemanager tool for Laravel Nova
Stars: ✭ 189 (-28.68%)
Mutual labels:  laravel, nova
Nova Impersonate
A Laravel Nova field allows you to authenticate as your users.
Stars: ✭ 182 (-31.32%)
Mutual labels:  laravel, nova
Collapsible Resource Manager
A custom sidebar menu with collapsible groups
Stars: ✭ 100 (-62.26%)
Mutual labels:  laravel, nova
Laravel Nova Excel
🚀 Supercharged Excel exports for Laravel Nova Resources
Stars: ✭ 259 (-2.26%)
Mutual labels:  laravel, nova
Awesome Nova
🎉 A curated list of awesome things related to Laravel Nova
Stars: ✭ 92 (-65.28%)
Mutual labels:  laravel, nova
Nova Translatable
Making Nova fields translatable
Stars: ✭ 119 (-55.09%)
Mutual labels:  laravel, nova
Nova Stripe Theme
A Laravel Nova theme closely resembling Stripe.
Stars: ✭ 71 (-73.21%)
Mutual labels:  laravel, nova
Nova Slug Field
Slug field for Laravel Nova
Stars: ✭ 131 (-50.57%)
Mutual labels:  laravel, nova
Laravel Nova Permission
A Laravel Nova tool for the Spatie Permission package
Stars: ✭ 59 (-77.74%)
Mutual labels:  laravel, nova
Nova Custom Email Sender
A Laravel Nova tool that sends ad-hoc email messages from the dashboard.
Stars: ✭ 62 (-76.6%)
Mutual labels:  laravel, nova
Laravel Nova Nested Form
This package allows you to include your nested relationships' forms into a parent form.
Stars: ✭ 169 (-36.23%)
Mutual labels:  laravel, nova
Nova Tags Field
A tags field to use in your Nova apps
Stars: ✭ 204 (-23.02%)
Mutual labels:  laravel, nova

Nova Tabs, awesome resource tabs for Nova


Latest Version on Github

  1. Installation
  2. Usage
    1. Tabs Panel
    2. Tabs Panel with Toolbar
    3. Relationship Tabs
    4. Combine Fields and Relations in Tabs
    5. Actions in Tabs
    6. Tabs on Edit View
  3. Tab object
  4. Customization
    1. Tab
    2. Default search
    3. Display more than 5 items
  5. Upgrade to 1.0.0

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require eminiarts/nova-tabs

Usage

Tabs Panel

image

You can group fields of a resource into tabs, you can use an array or a Tab object (as of 1.4.0)::

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;

public function fields()
{
    return [

        new Tabs('Tabs', [
            'Balance'    => [
                Number::make('Balance', 'balance'),
                Number::make('Total', 'total'),
            ],
            'Other Info' => [
                Number::make('Paid To Date', 'paid_to_date'),
            ],
        ]),

    ];
}

or

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;
use Eminiarts\Tabs\Tab;

public function fields()
{
    return [
        Tabs::make('Tabs', [
            Tab::make('Balance', [
                Number::make('Balance', 'balance'),
                Number::make('Total', 'total'),
            ]),
            Tab::make('Other Info', [
                Number::make('Paid To Date', 'paid_to_date')
            ]),
        ]),

    ];
}

Tabs with Toolbar

If you are only using Tabs without another default Panel, you can set withToolbar to true.

image

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;
use Eminiarts\Tabs\Tab;

public function fields(Request $request)
{
    return [
        Tabs::make('Contact Details', [
            Tab::make('Address', [
                ID::make('Id', 'id')->rules('required'),
                Text::make('Email', 'email')->sortable(),
                Text::make('Phone', 'phone')->sortable(),
            ]),
            Tab::make('Relations', [
                BelongsTo::make('User'),
                MorphTo::make('Contactable')->types([
                    Client::class,
                    Invoice::class,
                ]),
            ]),
        ])->withToolbar(),
    ];
}

Relationship Tabs

image

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;

class User extends Resource
{
    public function fields(Request $request)
    {
        return [
           Tabs::make('Relations', [
                HasMany::make('Invoices'),
                HasMany::make('Notes'),
                HasMany::make('Contacts')
            ]),

        ];
    }
}

Combine Fields and Relations in Tabs

image

image

use Eminiarts\Tabs\Tabs;

public function fields(Request $request)
{
    return [
        Tabs::make(__('Client Custom Details'), [
            new Panel(__('Details'), [
                    ID::make('Id', 'id')->rules('required')->hideFromIndex(),
                    Text::make('Name', 'name'),
            ]),
            HasMany::make('Invoices')
        ]),
    ];
}

Actions in Tabs

If your Model uses the Laravel\Nova\Actions\Actionable Trait you can put the Actions into a Tab like this:

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;
use Eminiarts\Tabs\Tab;
use Eminiarts\Tabs\ActionsInTabs; // Add this Trait
use Laravel\Nova\Actions\ActionResource; // Import the Resource

class Client extends Resource
{
    use ActionsInTabs; // Use this Trait

    public function fields(Request $request)
    {
        return [
            Tabs::make('Client Custom Details', [
                Tab::make('Address', [
                    ID::make('Id', 'id'),
                    Text::make('Name', 'name')->hideFromDetail(),
                ]),
                Tab::make('Invoices', [
                    HasMany::make('Invoices'),
                ]),
                Tab::make('Actions', [
                    $this->actionfield(), // Add Actions whererver you like.
                ]),
            ])->withToolbar(),
        ];
    }
}

Tabs on Edit View

image

If you want to show Tabs on the Edit View, use the TabsOnEdit Trait in your Resource.

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;
use Eminiarts\Tabs\TabsOnEdit; // Add this Trait

class Client extends Resource
{
    use TabsOnEdit; // Use this Trait
    //...
}

Tab object

As of v1.4.0 it's possible to use a Tab class instead of an array to represent your tabs.

Property Type Default Description
name string null The name of the tab, used for the slug. Defaults to the title if not set
showIf bool or Closure null If the result is truthy the tab will be shown. showIf takes priority over showUnless and if neither are set, true is assumed.
showUnless bool or Closure null If the result is falsy the tab will be shown. showIf takes priority over showUnless and if neither are set, true is assumed.
titleAsHtml bool false Whether the given title should be rendered as HTML. This potentially leaves you vulnerable for an XSS attack. Take precaution using this.
beforeIcon string null An icon (or anything else really) you want to render in front of the title. This potentially leaves you vulnerable for an XSS attack. Take precaution using this.
afterIcon string null An icon (or anything else really) you want to render behind the title. This potentially leaves you vulnerable for an XSS attack. Take precaution using this.
tabClass string or array Empty array A string or string array of classes to add to the tab. This sets the tabClass property, if you want to append you can use addTabClass instead.
bodyClass string or array Empty array A string or string array of classes to add to the tab's body. This sets the bodyClass property, if you want to append you can use addBodyClass instead.

Customization

Default search

By default, the Tabs component moves the search input and the create button to the tabs. If you have a lot of tabs, you can move them back down to its own line:

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;

class User extends Resource
{

    public function fields(Request $request)
    {
        return [
            Tabs::make('Relations', [
                HasMany::make('Invoices')
            ])->defaultSearch(true),
        ];
    }
}

Set ->defaultSearch(true) to revert it to its default.

image

Display more than 5 items

By default, any HasMany, BelongsToMany and MorphMany fields show 5 items in their index. You can use Nova's built-in static property $perPageViaRelationship on the respective resource to show more (or less).

Upgrade to 1.0.0

Thanks to dkulyk/nova-tabs the Package got a lot simpler.

  • No need to use a Trait anymore. Remove all AvailableTabFields Traits in your Resources.
  • Everything is in Tabs now. There is no TabsPanel anymore. Remove all TabsPanels and adjust your Fields according to this Readme.

Credits

Banner was created with https://banners.beyondco.de/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].