Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HepplerDotNet authored May 14, 2020
1 parent 1a1ec8d commit 307ba74
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# MySQL FullText Search Trait
PHP Trait to implement MySQL FullText Search in Eloquent Models

## Installation & Usage

First, pull in the package through Composer.

Run `composer require hepplerdotnet/fulltextsearch`

And then include the Trait within your Eloquent Model to implement FullTextSearch
.

```php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use HepplerDotNet\FullTextSearch\FullTextSearch;

class FooBar extends Model
{
use FullTextSearch;
/* Table Fields which should be searchable */
protected $searchable = [
'title',
'description'
];
...
}
```

Create a fulltext index in MySQL for the fields.

Use it as scope on your Model

```php
$result = FooBar::search('Foo')->get();
```

0 comments on commit 307ba74

Please sign in to comment.