Passed
Pull Request — master (#112)
by Ron
17:16
created

UpdateTipRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 3 1
A rules() 0 11 1
1
<?php
2
3
namespace App\Http\Requests\TechTips;
4
5
use App\Models\TechTip;
6
use Illuminate\Foundation\Http\FormRequest;
7
8
class UpdateTipRequest extends FormRequest
9
{
10
    /**
11
     * Determine if the user is authorized to make this request
12
     */
13
    public function authorize()
14
    {
15
        return $this->user()->can('update', TechTip::find($this->route('tech_tip')));
16
    }
17
18
    /**
19
     * Get the validation rules that apply to the request
20
     */
21
    public function rules()
22
    {
23
        return [
24
            'subject'      => 'required|string',
25
            'tip_type_id'  => 'required|exists:tech_tip_types',
26
            'details'      => 'required',
27
            'resendNotif'  => 'required|boolean',
28
            'sticky'       => 'required|boolean',
29
            'equipment'    => 'required|array',
30
            'fileList'     => 'nullable|array',
31
            'removedFiles' => 'nullable|array',
32
        ];
33
    }
34
}
35