定制 nevadskiy/nova-icon-picker 二次开发

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

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

nevadskiy/nova-icon-picker

最新稳定版本:0.1.0

Composer 安装命令:

composer require nevadskiy/nova-icon-picker

包简介

Icon Picker for Laravel Nova.

README 文档

README

Stand With Ukraine

Icon Picker for Laravel Nova

Latest Stable Version License

Screenshot

✅ Requirements

  • Laravel Nova 4
  • PHP 8.0 or newer

🔌 Installation

Install the package via Composer:

composer require nevadskiy/nova-icon-picker

📄 Documentation

Persisting

The field simply stores icons as a string representing the icon's name.

Iconsets

To add icons to the field, use the iconset method, which accepts the name of the iconset and the path to the directory with SVG icons. It is allowed to register multiple iconsets, but it requires defining unique prefixes so that icons can be resolved correctly.

Defining Field

To add a field to a resource, simply add it to resource's fields method:

use Nevadskiy\Nova\IconPicker\IconPicker;

public function fields(): array
{
    return [
        IconPicker::make('Icon')
            ->iconset(
                name: 'General'
                path: resource_path('svg'), 
            ),
            ->iconset(
                name: 'Brands', 
                path: resource_path('svg/brands'), 
                prefix: 'brands/' 
            )
            ->indexSize(16)
            ->detailSize(32),
    ]
}

Global configuration

It is also possible to configure the field via ServiceProvider:

public function boot(): void
{
    IconPicker::configure(function (IconPicker $icon) {
        $icon->iconset(
            name: 'Solid',
            path: resource_path('svg/solid'),
            prefix: 'solid/',
        );
    
        $icon->iconset(
            name: 'Outline',
            path: resource_path('svg/outline'),
            prefix: 'outline/',
        );
    
        $icon->iconset(
            name: 'Brands',
            path: resource_path('svg/brands'),
            prefix: 'brands/',
        );
    });
}

📜 License

The MIT License (MIT). Please see LICENSE for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-24