Passed
Pull Request — master (#54)
by Rafael
11:07 queued 01:53
created

RolesController::onConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Api\Controllers;
6
7
use Gewaer\Models\Roles;
8
9
/**
10
 * Class RolesController
11
 *
12
 * @package Gewaer\Api\Controllers
13
 *
14
 * @property Users $userData
15
 */
16
class RolesController extends BaseController
17
{
18
    /*
19
     * fields we accept to create
20
     *
21
     * @var array
22
     */
23
    protected $createFields = [];
24
25
    /*
26
     * fields we accept to create
27
     *
28
     * @var array
29
     */
30
    protected $updateFields = [];
31
32
    /**
33
     * set objects
34
     *
35
     * @return void
36
     */
37 1
    public function onConstruct()
38
    {
39 1
        $this->model = new Roles();
40
41
        //get the list of roes for the systema + my company
42 1
        $this->additionalSearchFields = [
43 1
            ['is_deleted', ':', '0'],
44 1
            ['companies_id', ':', '0|' . $this->userData->currentCompanyId()],
45
        ];
46 1
    }
47
}
48