Passed
Push — master ( 6b86f2...32da2e )
by Sebastien
04:17
created

CurrentUser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validator() 0 4 1
A make() 0 3 1
1
<?php
2
3
namespace Sebastienheyd\Boilerplate\Dashboard\Widgets;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Support\Facades\Auth;
7
use Sebastienheyd\Boilerplate\Dashboard\Widget;
8
9
class CurrentUser extends Widget
10
{
11
    protected $slug = 'current-user';
12
    protected $label = 'boilerplate::dashboard.current-user.label';
13
    protected $description = 'boilerplate::dashboard.current-user.description';
14
    protected $view = 'boilerplate::dashboard.widgets.current-user';
15
    protected $editView = 'boilerplate::dashboard.widgets.current-userEdit';
16
    protected $width = ['sm' => 12, 'md' => 6, 'xl' => 5, 'xxl' => 3];
17
18
    protected $parameters = [
19
        'color'    => 'info',
20
    ];
21
22
    public function make()
23
    {
24
        $this->assign('user', Auth::user());
25
    }
26
27
    public function validator(Request $request)
28
    {
29
        return validator()->make($request->post(), [
0 ignored issues
show
Bug introduced by
It seems like $request->post() can also be of type null and string; however, parameter $data of Illuminate\Validation\Factory::make() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
        return validator()->make(/** @scrutinizer ignore-type */ $request->post(), [
Loading history...
30
            'color' => 'required'
31
        ]);
32
    }
33
}