Package Data | |
---|---|
Maintainer Username: | BrunoQuaresma |
Maintainer Contact: | bruno_nonato_quaresma@hotmail.com (Bruno Quaresma) |
Package Create Date: | 2014-05-28 |
Package Last Update: | 2014-05-29 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-19 03:23:30 |
Package Statistics | |
---|---|
Total Downloads: | 7 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 10 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
A simple package for full text search using the Laravel's Eloquent.
In the require
key of composer.json
file add the following
"brunoquaresma/laravel-dbsearch": "dev-master"
Run the Composer update comand
$ composer update
In your config/app.php
add 'Brunoquaresma\LaravelDBSearch\LaravelDBSearchServiceProvider'
to the end of the $providers
array
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
...
'Brunoquaresma\LaravelDBSearch\LaravelDBSearchServiceProvider',
),
At the end of config/app.php
add 'LaravelDBSearch' => 'Brunoquaresma\LaravelDBSearch\Facades\LaravelDBSearch'
to the $aliases
array
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
...
'LaravelDBSearch' => 'Brunoquaresma\LaravelDBSearch\Facades\LaravelDBSearch'
),
###Basic usage
For this example we use a course model.
$courses = LaravelDBSearch::model('Course')
->field(array('name', 'description'))
->query('php')
->get();
###Use join
Get the courses where the owner have a name with John
.
$courses = LaravelDBSearch::model('Course')
->field(array('name', 'description', 'first_name', 'last_name', 'username'))
->join('courses.*', 'users', 'courses.user_id', '=', 'users.id')
->query('John')
->get();