PHP code example of workup / resource-navigation-tab
1. Go to this page and download the library: Download workup/resource-navigation-tab 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/ */
workup / resource-navigation-tab example snippets
use Workup\ResourceNavigationTab\HasResourceNavigationTabTrait;
use Workup\ResourceNavigationTab\ResourceNavigationTab;
class ExampleNovaResource extends Resource {
use HasResourceNavigationTabTrait; // Important!!
public function fields(Request $request)
{
return [
ResourceNavigationTab::make([
'label' => 'Information',
'behaveAsPanel' => true / false,
'fields' => [
Text::make('Name'),
Text::make('Age'),
HasMany::make('Hobbies')
]
]),
ResourceNavigationTab::make([ 'label' => 'Activities' ]),
ResourceNavigationTab::make([ 'label' => 'Social Interactions' ]),
ResourceNavigationTab::make([ 'label' => 'Settings' ]),
];
}
}
use Workup\ResourceNavigationTab\HasResourceNavigationTabTrait;
use Workup\ResourceNavigationTab\ResourceNavigationTab;
use Workup\ResourceNavigationTab\CardMode;
class ExampleNovaResource extends Resource {
public function fields(Request $request)
{
return [
ResourceNavigationTab::make([ 'label' => 'Profile' ]), // show all the available cards by default
ResourceNavigationTab::make([
'label' => 'Activities',
'cardMode' => CardMode::KEEP_ALL | CardMode::EXCLUDE_ALL // show all or remove all cards when this tab is active
]),
ResourceNavigationTab::make([
'label' => 'Preferences',
'cardMode' => CardMode::ONLY | CardMode::EXCEPT // show or remove only the selected cards
'cards' => [
ClientPerformanceCard::class,
ClientProfileCard::class,
]
]),
];
}
public function cards(Request $request)
{
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.