PHP code example of demency / nova-tabs

1. Go to this page and download the library: Download demency/nova-tabs library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

demency / nova-tabs example snippets


// 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'),
            ],
        ]),

    ];
}

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;

public function fields(Request $request)
    {
        return [

            (new Tabs('Contact Details', [
                'Address' => [
                    ID::make('Id', 'id')->rules('MorphTo::make('Contactable')->types([
                        Client::class,
                        Invoice::class,
                    ]),
                ]
            ]))->withToolbar(),

        ];
    }

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;

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

        ];
    }

}

use Eminiarts\Tabs\Tabs;

public function fields(Request $request)
{
    return [

        (new Tabs(__('Client Custom Details'), [
            new Panel(__('Details'), [
                    ID::make('Id', 'id')->rules('

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;
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 [
            
            (new Tabs('Client Custom Details', [
                'Address'  => [
                    ID::make('Id', 'id'),
                    Text::make('Name', 'name')->hideFromDetail(),
                ],
                'Invoices' => [
                    HasMany::make('Invoices'),
                ],
                'Actions'  => [
                    MorphMany::make(__('Actions'), 'actions', ActionResource::class), // Acc Actions whererver you like.
                ],
            ]))->withToolbar(),

        ];
    }
}

// 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
    //...
}

// in app/Nova/Resource.php

use Eminiarts\Tabs\Tabs;

class User extends Resource
{

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

        ];
    }
}