PHP code example of jengo / search
1. Go to this page and download the library: Download jengo/search library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jengo / search example snippets
use App\Models\ProductModel;
use Jengo\Search\Facades\Search;
// Execute a full-text search with facets and highlighting
$results = Search::query(ProductModel::class, 'oled laptop')
->where('category', 'Laptops')
->where('in_stock', true)
->highlight(['title', 'description'])
->facets(['category', 'brand'])
->paginate(12, 1)
->get();