1. Go to this page and download the library: Download vaened/laravel-criteria 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/ */
vaened / laravel-criteria example snippets
use Flagable, Indexed;
public function __construct(
private readonly IndexRepository $index,
private readonly FlagFiltrator $filter
) {
$this->apply(Criterias\PatientDeletionDate::without());
}
public function affiliatedBetween(DateTimeInterface $start, DateTimeInterface $end): self
{
$this->apply(Criterias\PatientAffiliation::between($start, $end));
}
public function observationLikeTo(string $observation): self
{
$this->apply(Criterias\PatientObservation::startsWith($observation));
}
public function onlyObserved(): self
{
$this->apply(Criterias\PatientObservation::isNotNull());
}
public function withoutObservation(): self
{
$this->apply(Criterias\PatientObservation::isNull());
}
public function historyEqualsTo(string $clinicHistory): self
{
$this->apply(Criterias\PatientClinicHistory::equals($clinicHistory));
}
public function documentNotEqualsTo(string $documentNumber): self
{
$this->apply(Criterias\PatientIdentityDocument::notEquals($documentNumber));
}
public function inDocuments(array $documentNumbers): self
{
$this->apply(Criterias\PatientIdentityDocument::in($documentNumbers));
}
protected function query(): Builder
{
return Patient::query();
}