PHP code example of nimblest / qeto

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

    

nimblest / qeto example snippets


use Qeto\BaseQuery;

class UserQueries extends BaseQuery 
{
    protected $name = 'User';
    
    public function byUsername(string $parameter): array
    {
        return ['users.username = "?"', [$parameter]];
    }
}

use Qeto\BaseQuery;

class UserQueries extends BaseQuery 
{
    protected $name = 'User';

    public function byUsername(string $parameter): array
    {
        return ['users.sku ' . ($this->inverse ? '!' : '') . '= "?"', [$parameter]];
    }
}

use Qeto\BaseQuery;

class UserQueries extends BaseQuery 
{
    protected $name = 'User';

    public function byType(string $parameter): array
    {
        return ['users.type ' . ($this->inverse ? '!' : '') . '= "?"', [$parameter]];
    }

    /**
     * Gets the created at date between two dates
     * @param  array $dates first key will be start date, second end date
     * @return array
     */
    public function byCreatedDay(array $dates): array
    {
        return ['users.created_at ' . ($this->inverse ? 'NOT ' : '') . 'BETWEEN "?"" AND "?"', [$dates]];
    }


    /**
     * Gets all user by a user type that were made during a certain time period
     * @param  array $parameters string of type, first key will be start date, second end date
     * @return array
     */
    public function getTypesBetweenDate(array $parameters): array
    {
        return $this->joinByAnd([
            'byType',
            'byCreatedDay'
        ], $parameters);
    }
}