Completed
Push — develop-3.0 ( 360277...bd5ff0 )
by Mohamed
06:52
created

Fetcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getNameDropdown() 0 4 1
A getRolesWithUsers() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Tinyissue package.
5
 *
6
 * (c) Mohamed Alsharaf <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Tinyissue\Repository\Role;
13
14
use Illuminate\Database\Eloquent\Collection;
15
use Tinyissue\Model\Role;
16
use Tinyissue\Repository\Repository;
17
18
class Fetcher extends Repository
19
{
20
    /**
21
     * @var Role
22
     */
23
    protected $model;
24
25
    public function __construct(Role $model)
26
    {
27
        $this->model = $model;
28
    }
29
30
    /**
31
     * Get list of all of the role names.
32
     *
33
     * @return array
34
     */
35
    public function getNameDropdown()
36
    {
37
        return $this->model->pluck('name', 'id')->prepend('Disabled')->all();
38
    }
39
40
    /**
41
     * Get collection of all of the roles with users within each role.
42
     *
43
     * @return Collection
44
     */
45
    public function getRolesWithUsers()
46
    {
47
        return $this->model->with('users')->orderBy('id', 'DESC')->get();
48
    }
49
}
50