shepp/nova-concat-search
最新稳定版本:v1.0.0
Composer 安装命令:
composer require shepp/nova-concat-search
包简介
Search by Concatenated fields in Laravel Nova
README 文档
README
Allows searching for Resources by a concatenation of multiple fields in Laravel Nova.
Example
An example use case is where a table contains first_name and last_name, and the Nova user would like to search by full name.
Example table;
| first_name | last_name | ... | |
|---|---|---|---|
| John | Doe | john@doe.com | ... |
Using standard Nova search, the term John Doe will not match this record as neither first name or last name match.
By adding a sub-array of column names into the $search property of a Resource, this package allows searching on concatenated database fields:
class User extends Resource { use Shepp\NovaConcatSearch\Traits\SearchesOnConcatColumns; public static $search = [ ['first_name', 'last_name'], // <---- 'email', ]; // ... }
This is effectively appending the following to the search query;
WHERE # ... OR CONACT(first_name, ' ', last_name) LIKE '%John Doe%'
Using the example above, this will allow the term John Doe to match the sample record.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2022-09-27