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

JobTitleRequest::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\Admin\Job;
11
12
use HRis\Http\Requests\Request;
13
14
class JobTitleRequest 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 8
            return ['name' => 'required|unique:job_titles'];
27
        }
28
29 10
        return [];
30
    }
31
32
    /**
33
     * Determine if the user is authorized to make this request.
34
     *
35
     * @return bool
36
     *
37
     * @author Bertrand Kintanar <[email protected]>
38
     */
39 14
    public function authorize()
40
    {
41 14
        return $this->hasAccess('admin.job.titles');
42
    }
43
}
44