承接 reedware/nova-field-manager 相关项目开发

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

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

reedware/nova-field-manager

Composer 安装命令:

composer require reedware/nova-field-manager

包简介

Creates a field facade for referencing fields.

README 文档

README

This package provides the convenience of not having to include the class path of each individual field in your resource class declaration. A new Field facade will be created, where you can defer all field creation through.

Latest Stable Version Total Downloads License

Installation

Require this package with composer.

composer require reedware/nova-field-manager

Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the service provider or facade. However, should you still need to reference them, here are their class paths:

\Reedware\NovaFieldManager\NovaFieldManagerServiceProvider::class // Service Provider
\Reedware\NovaFieldManager\Facade::class // Facade

Usage

You can now add fields to your resources in Nova by using the Field facade, rather than having to include each individual field in your resource class definition.

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        Field::id()->sortable(),

        Field::text('Name', 'display_name')
            ->sortable()
            ->rules('required', 'max:100'),

        Field::textarea('Description')
            ->rules('max:255'),

        Field::hasMany('Tasks', 'tasks', Task::class),

        Field::number('Tasks', function() {
            return $this->tasks_count;
        })

    ];
}

Custom Fields

All of the fields are configured in the nova-fields configuration file. First, you will need to create your own copy, by either running the php artisan vendor:publish command, or by copying the configuration file directory from this repository (found in ~/config/nova-fields.php).

You can easily add your own (or override the default fields) by manipulating this configuration file. The config key (id, text, hasMany, etc) is the method that you can call from the Field facade. The config value is the class path to the field, where a call to Field::<key>(...) defers to <value>::make(...).

The default fields provided by Nova will automatically be added, even if they are not present in your configuration file. However, if you have overridden one of the default fields (by specifying the same key name), your field will override the default Nova field.

<?php

return [
  
  /**
   * Custom Fields
   */
   'custom' => \NovaComponents\CustomField\Field::class

];
/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        Field::custom(...)
    ];
}

统计信息

  • 总下载量: 4.53k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固