Passed
Push — master ( 4a474d...df1b75 )
by Stephen
02:14
created

UserRolesQuery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 4
c 1
b 1
f 0
dl 0
loc 22
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A cacheKey() 0 3 1
A execute() 0 3 1
1
<?php
2
3
namespace Sfneal\Users\Queries;
4
5
use Sfneal\Users\Models\Role;
6
use Illuminate\Database\Eloquent\Collection;
7
use Sfneal\Caching\Traits\Cacheable;
8
use Sfneal\Queries\AbstractQuery;
9
10
class UserRolesQuery extends AbstractQuery
11
{
12
    use Cacheable;
13
14
    /**
15
     * Execute the Query.
16
     *
17
     * @return Collection
18
     */
19
    public function execute()
20
    {
21
        return Role::query()->whereTypeUser()->get();
22
    }
23
24
    /**
25
     * Retrieve the Query cache key.
26
     *
27
     * @return string
28
     */
29
    public function cacheKey(): string
30
    {
31
        return Role::getTableName().':types#user';
32
    }
33
}
34