承接 max26292/nova-mediable-manager 相关项目开发

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

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

max26292/nova-mediable-manager

最新稳定版本:v1.0.3

Composer 安装命令:

composer require max26292/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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-23