EmploymentStatusRequest::rules()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
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\Admin\Job;
23
24
use Irradiate\Api\Requests\Request;
25
26
class EmploymentStatusRequest 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 8
            return ['name' => 'required|unique:employment_statuses'];
39
        }
40
41 8
        return [];
42
    }
43
44
    /**
45
     * Determine if the user is authorized to make this request.
46
     *
47
     * @return bool
48
     *
49
     * @author Bertrand Kintanar <[email protected]>
50
     */
51 12
    public function authorize()
52
    {
53 12
        return $this->hasAccess('admin.job.employment-status');
54
    }
55
}
56