Completed
Push — master ( 1d96a4...49a6f0 )
by ARCANEDEV
04:17
created

UsersController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 6
cp 0
rs 9.4286
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php namespace Arcanesoft\Auth\Http\Controllers\Foundation;
2
3
use Arcanesoft\Auth\Bases\FoundationController;
4
use Arcanesoft\Auth\Models\User;
5
6
/**
7
 * Class     UsersController
8
 *
9
 * @package  Arcanesoft\Auth\Http\Controllers\Foundation
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class UsersController extends FoundationController
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Constructor
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /**
19
     * Instantiate the controller.
20
     */
21
    public function __construct()
22
    {
23
        parent::__construct();
24
25
        $this->setCurrentPage('auth-users');
26
        $this->addBreadcrumbRoute('Users', 'auth::foundation.users.index');
0 ignored issues
show
Documentation Bug introduced by
The method addBreadcrumbRoute does not exist on object<Arcanesoft\Auth\H...dation\UsersController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
27
    }
28
29
    /* ------------------------------------------------------------------------------------------------
30
     |  Main Functions
31
     | ------------------------------------------------------------------------------------------------
32
     */
33
    public function index()
34
    {
35
        $users = User::with('roles')->paginate(30);
36
37
        $title = 'List of users';
38
        $this->addBreadcrumb($title);
0 ignored issues
show
Documentation Bug introduced by
The method addBreadcrumb does not exist on object<Arcanesoft\Auth\H...dation\UsersController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
39
40
        return $this->view('foundation.users.list', compact('users'));
41
    }
42
43
    public function create()
44
    {
45
        $title = 'Create a new user';
46
        $this->addBreadcrumb($title);
0 ignored issues
show
Documentation Bug introduced by
The method addBreadcrumb does not exist on object<Arcanesoft\Auth\H...dation\UsersController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
47
48
        return $this->view('foundation.users.create');
49
    }
50
51
    public function store()
52
    {
53
        //
54
    }
55
56
    public function show($userId)
57
    {
58
        $user = User::with('roles', 'roles.permissions')->where('id', $userId)->first();
59
60
        $title = 'User details';
61
        $this->addBreadcrumb($title);
0 ignored issues
show
Documentation Bug introduced by
The method addBreadcrumb does not exist on object<Arcanesoft\Auth\H...dation\UsersController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
62
63
        return $this->view('foundation.users.show', compact('user'));
64
    }
65
66
    public function edit($userId)
0 ignored issues
show
Unused Code introduced by
The parameter $userId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
    {
68
        $title = 'Edit a user';
69
        $this->addBreadcrumb($title);
0 ignored issues
show
Documentation Bug introduced by
The method addBreadcrumb does not exist on object<Arcanesoft\Auth\H...dation\UsersController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
70
71
        return $this->view('foundation.users.edit');
72
    }
73
74
    public function update($userId)
0 ignored issues
show
Unused Code introduced by
The parameter $userId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
75
    {
76
        //
77
    }
78
79
    public function delete($userId)
0 ignored issues
show
Unused Code introduced by
The parameter $userId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
80
    {
81
        //
82
    }
83
}
84