You can install this package by simply run this composer command:
composer require artwinpro/laravel-search
Or require the package in your composer.json
:
"artwinpro/laravel-search": "dev-master"
and run
composer update
Add in model App\Posts:
use Artwinpro\LaravelSearch\SearchTrait;
class Posts extends Model
{
use SearchTrait;
// Searchable fields.
public $searchable = ['name', 'email', 'phone'];
}
And use:
$posts = Posts::search()->get(); // Get searched posts from the database.
Request:
/?name=Admin&[email protected]&phone=+37063028205