Completed
Push — api/develop ( dd11de...3cb7c9 )
by Bertrand
06:21
created

TerminationReasonRequest::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * This file is part of the HRis Software package.
5
 *
6
 * HRis - Human Resource and Payroll System
7
 *
8
 * @link    http://github.com/HB-Co/HRis
9
 */
10
namespace HRis\Api\Requests\PIM\Configuration;
11
12
use HRis\Http\Requests\Request;
13
14
class TerminationReasonRequest extends Request
15
{
16
    /**
17
     * Get the validation rules that apply to the request.
18
     *
19
     * @return array
20
     *
21
     * @author Bertrand Kintanar <[email protected]>
22
     */
23 14
    public function rules()
24
    {
25 14
        if ($this->isMethod('post')) {
26
            return [
27 8
                'name' => 'required|unique:termination_reasons',
28 8
            ];
29
        }
30
31 10
        return [];
32
    }
33
34
    /**
35
     * Determine if the user is authorized to make this request.
36
     *
37
     * @return bool
38
     *
39
     * @author Bertrand Kintanar <[email protected]>
40
     */
41 14
    public function authorize()
42
    {
43 14
        return $this->hasAccess('pim.configuration.termination-reasons');
44
    }
45
}
46