boadusamuel/search-nested-json-column
Composer 安装命令:
composer require boadusamuel/search-nested-json-column
包简介
Search Nested json column inside database with no case sensitivity
README 文档
README
This package enables you make search inside nested json column in a database without case sensitivity inside laravel projects.
Installation
You can install the package via composer:
composer require boadusamuel/search-nested-json-column
Usage
After installing the package, you can use the trait in your model like so:
use Boadusamuel\SearchNestedJsonColumn\SearchNestedJsonColumn;
class Product extends Model { use SearchNestedJsonColumn; }
Then you can use the search method like so:
Product::query()->when($search, function (Builder $query) use ($search) {
$this->searchJsonColumn($query, 'attribute_data->name->value->en', $search);
})->get();
Where attribute_data is the json column and name->value->en is the nested column you want to search.
Also $search is the value you want to search for and $this referring to the model with the SearchNestedJsonColumn trait.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-22