# element/search [![Latest Version on Packagist](https://img.shields.io/packagist/v/element/search.svg?maxAge=2592000&style=flat-square)](https://packagist.org/packages/element/search) [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg?style=flat-square)](LICENSE.md) [![Author](http://img.shields.io/badge/author-Garrett_Mills-blue.svg?style=flat-square)](https://glmdev.github.io/) [![Build Status](https://img.shields.io/travis/element/search/master.svg?style=flat-square)](https://travis-ci.org/element/search) This is a simple hit based search engine for Eloquent models. It can take a string and will search the given set of models for each word in that string. It prioritizes models based on the number of times each word in the search string is found in the searchable fields in the model, with more emphasis on longer words, and less on shorter. ## Install The search Element is available on composer. To install it, simply run: ``` bash $ composer require element/search ``` Then, add the following line to the `$providers` array in the `config/app.php` file: ``` php Element\Search\SearchServiceProvider::class, ``` ## Use Making your models searchable is easy. The models simply need to implement the `Element\Search\SearchableContract` interface. Then, add the `getSearchable()` method to the model. This method should return an array of the names of the Model's fields that the search engine can search. These fields should hold string/text data only. For Example: ``` php . ```