承接 lupennat/many-inline 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lupennat/many-inline

最新稳定版本:v1.0.0

Composer 安装命令:

composer require lupennat/many-inline

包简介

Laravel Nova - Many Inline Table

README 文档

README

  1. Requirements
  2. Installation
  3. Usage

Requirements

  • php: ^7.4 | ^8
  • laravel/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 HasManyInline trait 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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-22