2017 © Pedro Peláez
 

library laravel-match-against

Laravel builder match against eloquent syntax and related.

image

sciku1/laravel-match-against

Laravel builder match against eloquent syntax and related.

  • Monday, December 18, 2017
  • by sciku1
  • Repository
  • 2 Watchers
  • 4 Stars
  • 1,271 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 10 % Grown

The README.md

Laravel Match Against

A simple macro for doing match against fulltext searches with the Eloquent ORM api, currently in beta., (*1)

Requirements

  • Laravel 5.x
  • MySQL 3.3+

composer require sciku1/laravel-match-against, (*2)

Laravel 5.5

You're done!, (*3)

Laravel 5.x

You must register the service provider in your config/app.php, (*4)

'providers' => [
    ...
    Sciku1\LaravelMatchAgainst\Providers\MatchAgainstServiceProvider::class,
]

Usage

To run match against queries, the field must have a fulltext index, currently there only way to do this is, (*5)

DB::statement('ALTER TABLE `table_name` ADD FULLTEXT index_name(col1, col2)');

Order

The default behaviour is to order. Example:, (*6)

Model::match(['col1', 'col2'])->against('search terms')->get();

will generate, (*7)

SELECT * FROM models ORDER BY (MATCH (col1) AGAINST ('search terms')) DESC, (MATCH (col2) AGAINST ('search terms')) DESC

Where

To limit the results, you must use whereAgainst(), (*8)

Model::match(['col1', 'col2'])->whereAgainst('search terms')->get();

will generate, (*9)

SELECT * FROM models WHERE (MATCH (col1) AGAINST ('search terms')) > 0, (MATCH (col2) AGAINST ('search terms')) > 0

The Versions

18/12 2017

dev-master

9999999-dev

Laravel builder match against eloquent syntax and related.

  Sources   Download

MIT

The Requires

 

by Timothy Lopez

orm laravel eloquent macros builder match-against

18/12 2017

0.1.1

0.1.1.0

Laravel builder match against eloquent syntax and related.

  Sources   Download

MIT

The Requires

 

by Timothy Lopez

orm laravel eloquent macros builder match-against

15/12 2017

0.1.0

0.1.0.0

Laravel builder match against eloquent syntax and related.

  Sources   Download

MIT

The Requires

 

by Timothy Lopez

orm laravel eloquent macros builder match-against