EscolaLMS/Core

View on GitHub
src/Repositories/Criteria/UserCriterion.php

Summary

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


namespace EscolaLms\Core\Repositories\Criteria;

use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Builder;

class UserCriterion extends Criterion
{
    public function __construct(string $key, Authenticatable $user)
    {
        parent::__construct($key, $user);
    }

    public function apply(Builder $query): Builder
    {
        return $query->where($this->key, $this->value->getKey());
    }
}