1. Go to this page and download the library: Download foxws/laravel-scout-builder 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/ */
foxws / laravel-scout-builder example snippets
use Foxws\ScoutBuilder\AllowedFilter;
use Foxws\ScoutBuilder\AllowedSort;
use Foxws\ScoutBuilder\ScoutBuilder;
$results = ScoutBuilder::for(Post::class, $request)
->allowedFilters(
AllowedFilter::exact('status'),
AllowedFilter::in('tags'),
AllowedFilter::dynamicOperator('price'),
)
->allowedSorts(
AllowedSort::latest('recent', 'published_at'),
AllowedSort::field('title'),
)
->defaultSort('-recent')
->get();