Passed
Push — dependabot/npm_and_yarn/string... ( b56eb5...bc569b )
by
unknown
45:46 queued 33s
created

ModuleCreateRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 31
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 3
1
<?php
2
3
namespace Thinktomorrow\Chief\App\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Support\Facades\Auth;
7
use Thinktomorrow\Chief\Concerns\Translatable\TranslatableCommand;
8
9
class ModuleCreateRequest extends FormRequest
10
{
11
    use TranslatableCommand;
12
13
    /**
14
     * Determine if the user is authorized to make this request.
15
     *
16
     * @return bool
17
     */
18
    public function authorize()
19
    {
20
        return Auth::guard('chief')->user();
21
    }
22
23
    /**
24
     * Get the validation rules that apply to the request.
25
     * @return array
26
     */
27
    public function rules()
28
    {
29
        return [
30
            'module_key' => 'required',
31
            'slug'      => 'required|unique:modules,slug',
32
        ];
33
    }
34
35
    public function attributes()
36
    {
37
        return [
38
            'module_key' => 'type',
39
            'slug'      => 'interne link',
40
        ];
41
    }
42
}
43