TerminationReasonRequest::rules()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the HRis Software package.
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * Licensed under the 3-clause BSD License.
9
 *
10
 * This source file is subject to the 3-clause BSD License that is
11
 * bundled with this package in the LICENSE file.
12
 *
13
 * @version    alpha
14
 *
15
 * @author     Bertrand Kintanar <[email protected]>
16
 * @license    BSD License (3-clause)
17
 * @copyright  (c) 2014-2016, b8 Studios, Ltd
18
 *
19
 * @link       http://github.com/HB-Co/HRis
20
 */
21
22
namespace HRis\Api\Requests\PIM\Configuration;
23
24
use Irradiate\Api\Requests\Request;
25
26
class TerminationReasonRequest extends Request
27
{
28
    /**
29
     * Get the validation rules that apply to the request.
30
     *
31
     * @return array
32
     *
33
     * @author Bertrand Kintanar <[email protected]>
34
     */
35 12
    public function rules()
36
    {
37 12
        if ($this->isMethod('post')) {
38
            return [
39 8
                'name' => 'required|unique:termination_reasons',
40 8
            ];
41
        }
42
43 8
        return [];
44
    }
45
46
    /**
47
     * Determine if the user is authorized to make this request.
48
     *
49
     * @return bool
50
     *
51
     * @author Bertrand Kintanar <[email protected]>
52
     */
53 12
    public function authorize()
54
    {
55 12
        return $this->hasAccess('pim.configuration.termination-reasons');
56
    }
57
}
58