akki-io/laravel-nova-search
Composer 安装命令:
composer require akki-io/laravel-nova-search
包简介
A package that extends search for laravel nova
README 文档
README
Laravel Nova Search
Testing Statuses
This package provides a trait that extends the search behaviour of laravel nova resource.
Installation
You can install the package via composer:
composer require akki-io/laravel-nova-search
Next, add AkkiIo\LaravelNovaSearch\LaravelNovaSearchable trait to your base resource App\Nova\Resource class.
use AkkiIo\LaravelNovaSearch\LaravelNovaSearchable; abstract class Resource extends NovaResource { use LaravelNovaSearchable; // ... }
Usage
This package DOES NOT have fuzzy matching capabilities. If you are looking for robust fuzzy matching capabilities provided by "real" search engines, you should look into Laravel Scout.
This package adds the following types of search to your laravel nova resource.
- Search multiple columns using concatenation.
- Search every word in columns.
- Search relationship columns.
Search multiple columns using concatenation.
To define which resource fields are searchable, you may assign a two-dimensional array of database columns in the public static $searchConcatenation property of your resource class.
Each array in the array are names of columns that are concatenated using whitespace.
/** * The columns that should be concatenated and searched. * * @var array */ public static $searchConcatenation = [ ['first_name', 'last_name'], ['first_name', 'company'], ];
Search every word in columns.
To define which resource fields are searchable, you may assign an array of database columns in the public static $searchMatchingAny property of your resource class.
Every word in your input is searched for across all these columns.
/** * The columns that should be searched for any matching entry. * * @var array */ public static $searchMatchingAny = [ 'first_name', 'last_name', 'email', ];
Search relationship columns.
To define which resource fields are searchable, you may assign an array of database columns in the public static $searchRelations property of your resource class.
These database columns are from the related table that is used for searching.
This array has a relationship name as a key, and an array of columns to search for as a value.
/** * The relationship columns that should be searched. * * @var array */ public static $searchRelations = [ 'posts' => ['title', 'sub_title'], ];
Nested relationships
You may search nested relationships using dot notation.
/** * The relationship columns that should be searched. * * @var array */ public static $searchRelations = [ 'user.location' => ['state_abbr', 'country_abbr'], ];
Search multiple columns in relationship using concatenation.
To define which resource fields are searchable, you may assign a two-dimensional array of database columns in the public static $searchRelationsConcatenation property of your resource class.
Each array in the array are names of columns that are concatenated using whitespace.
/** * The relationship columns that should to be concatenated and searched. * * @var array */ public static $searchRelationsConcatenation = [ 'user' => [ ['first_name', 'last_name'], ['email'] ], ];
Search every word in columns of a relationship.
To define which resource fields are searchable, you may assign an array of database columns in the public static $searchRelationsMatchingAny property of your resource class.
Every word in your input is searched for across all these columns.
/** * The relationship columns that should be searched for any matching entry. * * @var array */ public static $searchRelationsMatchingAny = [ 'user' => ['first_name', 'last_name'], ];
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email hello@akki.io instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
akki-io/laravel-nova-search 适用场景与选型建议
akki-io/laravel-nova-search 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 576.21k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2020 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「akki-io」 「laravel-nova-search」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 akki-io/laravel-nova-search 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 akki-io/laravel-nova-search 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 akki-io/laravel-nova-search 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to retrieve data from Google Analytics 4 using the GA4 Query Explorer
A Laravel package to retrieve data from Google Analytics 4 using the GA4 Query Explorer
A package that extends search for laravel nova
Create a cron expression based on user input
A simple package for laravel nova to manage all nova related assets.
统计信息
- 总下载量: 576.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 21
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-29
