lupennat/many-inline
最新稳定版本:v1.0.0
Composer 安装命令:
composer require lupennat/many-inline
包简介
Laravel Nova - Many Inline Table
README 文档
README
Requirements
php: ^7.4 | ^8laravel/nova: ^4
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require lupennat/many-inline
Usage
ManyInline Packages automatically enable a new method inline for all Many Relationship Fields:
- HasMany
- BelongsToMany
- HasManyThrough
- MorphToMany
The table will be displayed as a Field of the resource, without any actions and without the toolbar.
use Laravel\Nova\Fields\HasMany; use Laravel\Nova\Http\Requests\NovaRequest; class User extends Resource { public function fields(Request $request) { return [ HasMany::make('User Post', 'posts', Post::class)->inline(); ]; } }
You can manage Field visibility on related resource through the new methods hideWhenInline or onlyOnInline.\
to manage field visibility you must include the
HasManyInlinetrait on related resource.
use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\Text; use Laravel\Nova\Http\Requests\NovaRequest; use Lupennat\ManyInline\HasManyInline; class Posts extends Resource { use HasManyInline; public function fields(Request $request) { return [ ID::make(), BelongsTo::make(__('User'), 'user', User::class)->hideWhenInline(), Text::make(__('Extra Field'), 'extra')->onlyOnInline() ]; } }
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-22