定制 naska-it/nova-mediable-manager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

naska-it/nova-mediable-manager

Composer 安装命令:

composer require naska-it/nova-mediable-manager

包简介

A Laravel Nova mediable manager tool and field.

README 文档

README

This package is still in heavy development, please dont use in production

Laravel Nova Media Manager and Field to manage Polymorphic ManyToMany Relationships.

Table of Contents

Manager

Install

composer require naska-it/nova-mediable-manager
php artisan vendor:publish --provider="NaskaIt\NovaMediableManager\ToolServiceProvider"
php artisan migrate
php artisan storage:link

Configuration

Check in config/nova-mediable-manager.php for some extra configuration Enable Manager add to app/Providers/NovaServiceProvider.php

/**
 * Get the tools that should be listed in the Nova sidebar.
 *
 * @return array
 */
public function tools()
{
    return [
        new \NaskaIt\NovaMediableManager\NovaMediableManager
    ];
}

Using Field - first add HasMedia trait to your model

use NaskaIt\NovaMediableManager\HasMedia;

class Page extends Model
{
    use HasMedia;

Using Field - Nova Resource

use NaskaIt\NovaMediableManager\Mediable;

class Page extends Resource
{
    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [
            ID::make(__('ID'), 'id')->sortable(),

            Text::make('Name'),
            Trix::make('Body'),

            Mediable::make('Image')
                ->hideFromIndex()
                ->isSingle(),

            Mediable::make('Featured')
                ->isSingle(),

            Mediable::make('Gallery'),
        ];
    }

Flexible

If you use Mediable field inside Flexible Layout

use NaskaIt\NovaMediableManager\Mediable;

public function fields()
{
    return [
        Text::make('Headline'),
        Text::make('Slogan'),
        Mediable::make('Block')
        	->isSingle()
        	->isFlexible(),
    ];
}

Add to your layout HasFlexibleMediable trait

use NaskaIt\NovaMediableManager\HasFlexibleMediable;

class BlockLayout extends Layout
{
    use HasFlexibleMediable;

Credits

Where I get some code from :)

Alternatives

What I was using Before

Examples

Manager

Field

统计信息

  • 总下载量: 308
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 3
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固