GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AdminController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 3
dl 0
loc 48
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 21 1
A edit() 0 22 2
1
<?php
2
3
namespace Serverfireteam\Panel;
4
/*
5
 * To change this license header, choose License Headers in Project Properties.
6
 * To change this template file, choose Tools | Templates
7
 * and open the template in the editor.
8
 */
9
use Serverfireteam\Panel\CrudController;
10
use \Illuminate\Http\Request;
11
/**
12
 * Description of PagePanel
13
 *
14
 * @author alireza
15
 */
16
class AdminController extends CrudController{
17
    
18
    public function all($entity){
19
        parent::all($entity); 
20
21
        $this->filter = \DataFilter::source(Admin::with('roles'));
22
        $this->filter->add('id', 'ID', 'text');
23
        $this->filter->add('first_name', 'First name', 'text');
24
        $this->filter->add('last_name', 'Last Name', 'text');
25
        $this->filter->add('email', 'Email', 'text');
26
        $this->filter->submit('search');
27
        $this->filter->reset('reset');
28
        $this->filter->build();
29
                
30
        $this->grid = \DataGrid::source($this->filter);
31
        $this->grid->add('id','ID', true)->style("width:100px");
32
        $this->grid->add('{{ $first_name }} {{ $last_name}}','first name');
33
        $this->grid->add('email','Email');
34
       $this->grid->add('{{ implode(", ", $roles->pluck("name")->all()) }}', 'Role');
35
36
        $this->addStylesToGrid();
37
        return $this->returnView();
38
    }
39
    
40
    public function  edit($entity){
41
        
42
        if (\Request::input('password') != null )
0 ignored issues
show
Bug introduced by
It seems like you are loosely comparing \Request::input('password') of type string|array|null against null; this is ambiguous if the string can be empty. Consider using a strict comparison !== instead.
Loading history...
43
        {
44
            $new_input = array('password' => \Hash::make(\Request::input('password'))); 
45
            \Request::merge($new_input);
46
        }
47
        
48
        parent::edit($entity);
49
50
        $this->edit = \DataEdit::source(new Admin());
51
52
        $this->edit->label('Edit Admin');
53
        $this->edit->link("rapyd-demo/filter","Articles", "TR")->back();
54
        $this->edit->add('email','Email', 'text')->rule('required|min:5');
55
        $this->edit->add('first_name', 'firstname', 'text');
56
        $this->edit->add('last_name', 'lastname', 'text');
57
        $this->edit->add('password', 'password', 'password')->rule('required');  
58
        $this->edit->add('roles','Roles','checkboxgroup')->options(Role::pluck('name', 'id')->all());
59
60
        return $this->returnEditView();
61
    }
62
63
}
64