Completed
Push — master ( a8f538...8e198c )
by Mahmoud
07:38
created

AdminsCriteria::apply()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace App\Containers\User\Data\Criterias;
4
5
use App\Port\Criterias\Abstracts\Criteria;
6
use Prettus\Repository\Contracts\RepositoryInterface as PrettusRepositoryInterface;
7
8
/**
9
 * Class AdminsCriteria.
10
 *
11
 * @author  Mahmoud Zalt <[email protected]>
12
 */
13
class AdminsCriteria extends Criteria
14
{
15
16
  /**
17
   * @param                                                   $model
18
   * @param \Prettus\Repository\Contracts\RepositoryInterface $repository
19
   *
20
   * @return mixed
21
   */
22
  public function apply($model, PrettusRepositoryInterface $repository)
23
  {
24
    return $model->whereHas('roles', function ($q) {
25
      $q->where('name', 'admin');
26
    });
27
  }
28
}
29