承接 metasync-site/nova-has-many-searchable 相关项目开发

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

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

metasync-site/nova-has-many-searchable

最新稳定版本:v1.0.5

Composer 安装命令:

composer require metasync-site/nova-has-many-searchable

包简介

A Laravel Nova field for searchable has-many relationships

README 文档

README

A Laravel Nova field that provides a searchable interface for has-many relationships with the ability to create new related resources.

screenshot of the search relations tool

Requirements

  • PHP 8.2+
  • Laravel 11.x | 12.x
  • Laravel Nova 4.x | 5.x

Installation

You can install the package via composer:

composer require metasync-site/nova-has-many-searchable

Usage

use MetasyncSite\NovaHasManySearchable\HasManySearchable;

public function fields(NovaRequest $request)
{
    return [
        HasManySearchable::make('Coupons')
            ->relationshipConfig(
                resourceClass: CouponsResource::class,
                foreignKey: 'GoodsDataId',
                displayCallback: function ($coupon) {
                    return "{$coupon?->Name} (Type: {$coupon->Type})";
                }
            )
            ->withCreateButton(true, 'Create New Coupon'),
    ];
}

Features

  • 🔍 Searchable interface for has-many relationships
  • ✨ Custom display formatting
  • ➕ Optional "Create New" button with modal
  • 🎨 Dark mode support
  • 🎯 Type-safe implementation

Configuration

Display Callback

You can customize how each option is displayed using the displayCallback:

HasManySearchable::make('Coupons')
    ->relationshipConfig(
        resourceClass: CouponsResource::class,
        foreignKey: 'GoodsDataId',
        displayCallback: fn($model) => "{$model->name} ({$model->code})"
    )

Create Button

Enable the create button with an optional custom label:

HasManySearchable::make('Coupons')
    ->withCreateButton(true, 'Add New Coupon')

Security Vulnerabilities

If you discover any security vulnerabilities, please email metasyncsite@gmail.com

Credits

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-21