EscolaLMS/Core

View on GitHub
src/Repositories/Criteria/Primitives/WhereNotInOrIsNullCriterion.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace EscolaLms\Core\Repositories\Criteria\Primitives;

use EscolaLms\Core\Repositories\Criteria\Criterion;
use Illuminate\Database\Eloquent\Builder;

class WhereNotInOrIsNullCriterion extends Criterion
{
    public function apply(Builder $query): Builder
    {
        return $query->where(function ($query) {
            $query->orWhereNotIn($this->key, $this->value);
            $query->orWhereNull($this->key);
        });
    }
}