|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pratiksh\Adminetic\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
|
|
6
|
|
|
use App\Models\User; |
|
|
|
|
|
|
7
|
|
|
use Pratiksh\Adminetic\Contracts\UserRepositoryInterface; |
|
8
|
|
|
use Pratiksh\Adminetic\Http\Requests\UserRequest; |
|
9
|
|
|
|
|
10
|
|
|
class UserController extends Controller |
|
11
|
|
|
{ |
|
12
|
|
|
protected $userRepositoryInterface; |
|
13
|
|
|
|
|
14
|
|
|
public function __construct(UserRepositoryInterface $userRepositoryInterface) |
|
15
|
|
|
{ |
|
16
|
|
|
$this->userRepositoryInterface = $userRepositoryInterface; |
|
17
|
|
|
$this->authorizeResource(User::class, 'user'); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Display a listing of the resource. |
|
22
|
|
|
* |
|
23
|
|
|
* @return \Illuminate\Http\Response |
|
24
|
|
|
*/ |
|
25
|
|
|
public function index() |
|
26
|
|
|
{ |
|
27
|
|
|
return view('adminetic::admin.user.index', $this->userRepositoryInterface->userIndex()); |
|
|
|
|
|
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Show the form for creating a new resource. |
|
32
|
|
|
* |
|
33
|
|
|
* @return \Illuminate\Http\Response |
|
34
|
|
|
*/ |
|
35
|
|
|
public function create() |
|
36
|
|
|
{ |
|
37
|
|
|
return view('adminetic::admin.user.create', $this->userRepositoryInterface->userCreate()); |
|
|
|
|
|
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Store a newly created resource in storage. |
|
42
|
|
|
* |
|
43
|
|
|
* @param \Pratiksh\Adminetic\Http\Requests\UserRequest $request |
|
44
|
|
|
* @return \Illuminate\Http\Response |
|
45
|
|
|
*/ |
|
46
|
|
|
public function store(UserRequest $request) |
|
47
|
|
|
{ |
|
48
|
|
|
$this->userRepositoryInterface->userStore($request); |
|
49
|
|
|
|
|
50
|
|
|
return redirect(adminRedirectRoute('user'))->withSuccess('User Created Sucessfully'); |
|
|
|
|
|
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Display the specified resource. |
|
55
|
|
|
* |
|
56
|
|
|
* @param \App\Models\User $user |
|
57
|
|
|
* @return \Illuminate\Http\Response |
|
58
|
|
|
*/ |
|
59
|
|
|
public function show(User $user) |
|
60
|
|
|
{ |
|
61
|
|
|
return view('adminetic::admin.profile.show', $this->userRepositoryInterface->userShow($user)); |
|
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* Show the form for editing the specified resource. |
|
66
|
|
|
* |
|
67
|
|
|
* @param \App\Models\User $user |
|
68
|
|
|
* @return \Illuminate\Http\Response |
|
69
|
|
|
*/ |
|
70
|
|
|
public function edit(User $user) |
|
71
|
|
|
{ |
|
72
|
|
|
return view('adminetic::admin.user.edit', $this->userRepositoryInterface->userEdit($user)); |
|
|
|
|
|
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Update the specified resource in storage. |
|
77
|
|
|
* |
|
78
|
|
|
* @param \Pratiksh\Adminetic\Http\Requests\UserRequest $request |
|
79
|
|
|
* @param \App\Models\User $user |
|
80
|
|
|
* @return \Illuminate\Http\Response |
|
81
|
|
|
*/ |
|
82
|
|
|
public function update(UserRequest $request, User $user) |
|
83
|
|
|
{ |
|
84
|
|
|
$this->userRepositoryInterface->userUpdate($request, $user); |
|
85
|
|
|
|
|
86
|
|
|
return request()->has('from_profile') ? redirect(adminEditRoute('profile', $user->profile->id))->withInfo('User Updated Sucessfully') : redirect(adminRedirectRoute('user'))->withInfo('User Updated Sucessfully'); |
|
|
|
|
|
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Remove the specified resource from storage. |
|
91
|
|
|
* |
|
92
|
|
|
* @param \App\Models\User $user |
|
93
|
|
|
* @return \Illuminate\Http\Response |
|
94
|
|
|
*/ |
|
95
|
|
|
public function destroy(User $user) |
|
96
|
|
|
{ |
|
97
|
|
|
$this->userRepositoryInterface->userDestroy($user); |
|
98
|
|
|
|
|
99
|
|
|
return redirect(adminRedirectRoute('user'))->withFail('User Deleted Sucessfully'); |
|
|
|
|
|
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths