PHP code example of olegario / page-search-traits

1. Go to this page and download the library: Download olegario/page-search-traits 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/ */

    

olegario / page-search-traits example snippets

bash
class testRepository
{
    private PDO $conection; 
    use Paginate;
    use PaginateRepository;
    use Search;
    use SearchRepository;

    protected array $fieldMap = [
        'status'       => 'teste_stts',
        'description'  => 'teste_dscrc',
        'number'       => 'teste_nmr',
    ];

    public function all(): array
    {
        $select = $this->conection->query("
             SELECT * FROM tabela 
                {$this->sqlJoind()} 
                {$this->sqlSearch()}
                {$this->sqlSearchOr()}
                {$this->sqlSearchOrConditions()}
                {$this->sqlOrderBy()} 
                {$this->sqlGroupBy()} 
                {$this->sqlPaginate()}
        ")->fetchAll(PDO::FETCH_ASSOC);
    }
}
bash
protected array $fieldMap = [
        'status'       => 'teste_stts',
        'description'  => 'teste_dscrc',
        'number'       => 'teste_nmr',
];