workup/resource-navigation-tab
Composer 安装命令:
composer require workup/resource-navigation-tab
包简介
Organize your long pile of tables and relationships into structured pages.
README 文档
README
Organize your long pile of tables and relationships into structured pages.
Installation
You can install the package via composer:
composer require workup/resource-navigation-tab
Basic Usage
First, import HasResourceNavigationTabTrait trait into your resource
and start grouping your fields with the ResourceNavigationTab object:
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' ]), ]; } }
Once setup navigate to your resource detail view, and you should be presented with this card:
By default the main resource table (the one with the edit/delete buttons) will have the same title as your tabs,
however you can customize it by calling ->resourceTableTitle('Another title')
public function fields(Request $request) { return [ ResourceNavigationTab::make([ 'label' => 'Tab Title', 'resourceTableTitle' => 'Resource Table Title' 'fields' => [...] ]), ]; }
Every defined card will be shown on every tab by default, however you can choose which card you want to show when a specific tab is selected:
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() ]; } }
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 831
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-03

