承接 suenerds/nova-searchable-belongs-to-filter 相关项目开发

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

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

suenerds/nova-searchable-belongs-to-filter

最新稳定版本:v2.0.3

Composer 安装命令:

composer require suenerds/nova-searchable-belongs-to-filter

包简介

Searchable Nova filter for belongsTo relationships.

README 文档

README

Searchable Nova filter for belongsTo relationships.

⚠️⚠️⚠️ Attention ⚠️⚠️⚠️

This package is not needed with Nova 4, you can achieve the same behaviour with:

BelongsTo::make('User')
    ->searchable()
    ->filterable(),

Demo

demo

Prerequisites

This package assumes you have a text-search setup for your Eloquent models. See Laravel Scout.

Installation

composer require suenerds/nova-searchable-belongs-to-filter

Usage

For this example let's assume a user belongs to a department and a department has many users. To make the relationship searchable via a filter, add this to the filters() function of your Nova user resource:

By default the filter will display the name of the fieldAttribute you passed on instantiation. You can customize the name by passing it as an argument to the filter's construct function, for example my-new-name.

// app/Nova/User.php

use Suenerds\NovaSearchableBelongsToFilter\NovaSearchableBelongsToFilter

public function filters(Request $request)
{
    return [
	(new NovaSearchableBelongsToFilter('my-new-name'))
	    ->fieldAttribute('department')
	    ->filterBy('department_id')
    ];
}

统计信息

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

GitHub 信息

  • Stars: 29
  • Watchers: 2
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04