|
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'); |
|
|
|
|
|
|
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); |
|
|
|
|
|
|
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); |
|
|
|
|
|
|
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); |
|
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
return $this->view('foundation.users.show', compact('user')); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function edit($userId) |
|
|
|
|
|
|
67
|
|
|
{ |
|
68
|
|
|
$title = 'Edit a user'; |
|
69
|
|
|
$this->addBreadcrumb($title); |
|
|
|
|
|
|
70
|
|
|
|
|
71
|
|
|
return $this->view('foundation.users.edit'); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function update($userId) |
|
|
|
|
|
|
75
|
|
|
{ |
|
76
|
|
|
// |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function delete($userId) |
|
|
|
|
|
|
80
|
|
|
{ |
|
81
|
|
|
// |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|
If you implement
__calland 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
__callis implemented by a parent class and only the child class knows which methods exist: