在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):eminiarts/nova-tabs开源软件地址(OpenSource Url):https://github.com/eminiarts/nova-tabs开源编程语言(OpenSource Language):PHP 51.1%开源软件介绍(OpenSource Introduction):Requirements
For Laravel Nova Version 3, please use nova-tabs v1 instead. InstallationYou can install the package in to a Laravel app that uses Nova via composer: composer require eminiarts/nova-tabs UsageTabs PanelYou 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\Traits\HasTabs;
use Eminiarts\Tabs\Tabs;
class User extends Resource
{
use HasTabs;
public function fields(Request $request)
{
return [
new Tabs('Some Title', [
'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\Traits\HasTabs;
use Eminiarts\Tabs\Tabs;
use Eminiarts\Tabs\Tab;
class User extends Resource
{
use HasTabs;
public function fields(Request $request)
{
return [
Tabs::make('Some Title', [
Tab::make('Balance', [
Number::make('Balance', 'balance'),
Number::make('Total', 'total'),
]),
Tab::make('Other Info', [
Number::make('Paid To Date', 'paid_to_date')
]),
]),
];
}
} The first tab in every Relationship TabsThese are a bit outdated, as the search and create buttons now show within the panel down where the actual content is displayed, not in the tab panel. // in app/Nova/Resource.php
use Eminiarts\Tabs\Tabs;
use Laravel\Nova\Fields\HasMany;
use Eminiarts\Tabs\Traits\HasTabs;
class User extends Resource
{
use HasTabs;
public function fields(Request $request)
{
return [
Tabs::make('Relations', [
HasMany::make('Invoices'),
HasMany::make('Notes'),
HasMany::make('Contacts')
]),
];
}
} Combine Fields and Relations in Tabsuse Eminiarts\Tabs\Tabs;
use Laravel\Nova\Fields\HasMany;
use Eminiarts\Tabs\Traits\HasTabs;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
class User extends Resource
{
use HasTabs;
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 TabsIf your Model uses the // in app/Nova/Resource.php
use Eminiarts\Tabs\Tabs;
use Eminiarts\Tabs\Tab;
use Eminiarts\Tabs\Traits\HasTabs;
use Eminiarts\Tabs\Traits\HasActionsInTabs; // Add this Trait
use Laravel\Nova\Actions\ActionResource; // Import the Resource
class Client extends Resource
{
use HasTabs;
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.
]),
]),
];
}
} Tabs on Edit ViewTabs are always shown on edit view as of Nova 4 for now. Tab objectAs of v1.4.0 it's possible to use a
CustomizationDisplay more than 5 itemsBy default, any Upgrade to 2.0.0
CreditsBanner was created with https://banners.beyondco.de/ |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论