定制 khalin/nova4-searchable-belongs-to-filter 二次开发

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

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

khalin/nova4-searchable-belongs-to-filter

最新稳定版本:1.0.1

Composer 安装命令:

composer require khalin/nova4-searchable-belongs-to-filter

包简介

Searchable Nova 4 filter for belongsTo relationships.

README 文档

README

Searchable Nova filter for belongsTo relationships.

Demo

demo

Prerequisites

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

Installation

composer require khalin/nova4-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 Khalin\Nova4SearchableBelongsToFilter\NovaSearchableBelongsToFilter

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

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 9
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-18