1. Go to this page and download the library: Download waxwink/search-repository 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/ */
waxwink / search-repository example snippets
use Waxwink\SearchRepository\SearchRepository;
class UserSearchRepository extends SearchRepository
{
protected $searchable_attributes = [
'name',
'last_name',
'cellphone',
];
protected $filterable_attributes = [
'birth_date',
'gender',
'name',
'last_name',
'cellphone',
'email',
'created_at'
];
public function __construct()
{
$this->query = App\User::query();
}
}
use Waxwink\SearchRepository\Concerns\SearchTrait;
use Illuminate\Http\Request;
class UserController {
use SearchTrait;
public function index(Request $request, UserSearchRepository $userSearchRepository)
{
$users = $this->filterAndSearch($request, $userSearchRepository)->paginate();
// ...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.