CareerRequest::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 18
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 21
rs 9.6666
1
<?php
2
3
namespace Adminetic\Website\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Support\Str;
7
8
class CareerRequest extends FormRequest
9
{
10
    /**
11
     * Determine if the user is authorized to make this request.
12
     *
13
     * @return bool
14
     */
15
    public function authorize()
16
    {
17
        return true;
18
    }
19
20
    /**
21
     * Prepare the data for validation.
22
     *
23
     * @return void
24
     */
25
    protected function prepareForValidation()
26
    {
27
        $this->merge([
28
            'slug' => Str::slug($this->title),
29
        ]);
30
    }
31
32
    /**
33
     * Get the validation rules that apply to the request.
34
     *
35
     * @return array<string, mixed>
36
     */
37
    public function rules()
38
    {
39
        $id = $this->career->id ?? '';
40
41
        return [
42
            'title' => 'required|max:255',
43
            'slug' => 'required|max:255|unique:'.config('website.table_prefix', 'website').'_careers,slug,'.$id,
44
            'designation' => 'required|max:255',
45
            'group' => 'nullable|numeric',
46
            'location' => 'nullable|max:255',
47
            'salary' => 'required|max:255',
48
            'deadline' => 'required',
49
            'excerpt' => 'required|max:5500',
50
            'description' => 'nullable|max:55000',
51
            'summary' => 'nullable',
52
            'application_description' => 'nullable|file',
53
            'application_syllabus' => 'nullable|file',
54
            'application_sort_list' => 'nullable|file',
55
            'application_result' => 'nullable|file',
56
            'add_apply_button' => 'nullable',
57
            'active' => 'sometimes|boolean',
58
        ];
59
    }
60
}
61