<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
digital-creative / resource-navigation-tab example snippets
use DigitalCreative\ResourceNavigationTab\HasResourceNavigationTabTrait;
use DigitalCreative\ResourceNavigationTab\ResourceNavigationField;
class ExampleNovaResource extends Resource {
use HasResourceNavigationTabTrait;
public function fields(NovaRequest $request): array
{
return [
ResourceNavigationField::make('Information')
->fields([
Text::make('Name'),
Text::make('Age'),
HasMany::make('Hobbies'),
]),
ResourceNavigationField::make('Activities')->fields([ ... ]),
ResourceNavigationField::make('Social Interactions')->fields([ ... ]),
ResourceNavigationField::make('Settings')->fields([ ... ]),
];
}
}
use DigitalCreative\ResourceNavigationTab\HasResourceNavigationTabTrait;
use DigitalCreative\ResourceNavigationTab\ResourceNavigationField;
use DigitalCreative\ResourceNavigationTab\CardMode;
class ExampleNovaResource extends Resource {
use HasResourceNavigationTabTrait;
public function fields(NovaRequest $request): array
{
return [
ResourceNavigationField::make('Information'), // show all the available cards by default
ResourceNavigationField::make('Activities')->withCards([ DailySalesCard::class, ClientProfileCard::class ]), // only show these cards when this tab is active
ResourceNavigationField::make('Settings')->withoutCards(), // hide all cards when this tab is active
];
}
public function cards(NovaRequest $request): array
{
return [
new ClientPerformanceCard(),
new DailySalesCard(),
new ClientProfileCard()
];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.