An open API service indexing awesome lists of open source software.

https://github.com/technote-space/laravel-search-helper

Search helper for Laravel
https://github.com/technote-space/laravel-search-helper

laravel search

Last synced: 5 months ago
JSON representation

Search helper for Laravel

Awesome Lists containing this project

README

          

# Laravel Search Helper

[![CI Status](https://github.com/technote-space/laravel-search-helper/workflows/CI/badge.svg)](https://github.com/technote-space/laravel-search-helper/actions)
[![codecov](https://codecov.io/gh/technote-space/laravel-search-helper/branch/main/graph/badge.svg)](https://codecov.io/gh/technote-space/laravel-search-helper)
[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/laravel-search-helper/badge)](https://www.codefactor.io/repository/github/technote-space/laravel-search-helper)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/laravel-search-helper/blob/main/LICENSE)
[![PHP: >=7.4](https://img.shields.io/badge/PHP-%3E%3D7.4-orange.svg)](http://php.net/)

*Read this in other languages: [English](README.md), [日本語](README.ja.md).*

Laravel用検索ヘルパー

[Packagist](https://packagist.org/packages/technote/laravel-search-helper)

## Table of Contents

Details

- [インストール](#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB)
- [使用方法](#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)
- [Author](#author)

## インストール
```
composer require technote/laravel-search-helper
```

## 使用方法
1. `Searchable Contract` と `Searchable Trait` を実装
1. `setConditions` メソッド を実装

```php
each(function ($search) use ($query) {
$query->where(function ($builder) use ($search) {
/** @var Builder $builder */
$builder->where('items.name', 'like', "%{$search}%");
});
});
}
}
}
```
1. `search`メソッドを呼び出し

```php
[
'test',
],
'ids' => [1, 2, 3],
])->get();
```

## Author
[GitHub (Technote)](https://github.com/technote-space)
[Blog](https://technote.space)