|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pratiksh\Adminetic\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
|
|
6
|
|
|
use Pratiksh\Adminetic\Contracts\ProfileRepositoryInterface; |
|
7
|
|
|
use Pratiksh\Adminetic\Http\Requests\ProfileRequest; |
|
8
|
|
|
use Pratiksh\Adminetic\Models\Admin\Profile; |
|
9
|
|
|
|
|
10
|
|
|
class ProfileController extends Controller |
|
11
|
|
|
{ |
|
12
|
|
|
protected $profileRepositoryInterface; |
|
13
|
|
|
|
|
14
|
|
|
public function __construct(ProfileRepositoryInterface $profileRepositoryInterface) |
|
15
|
|
|
{ |
|
16
|
|
|
$this->profileRepositoryInterface = $profileRepositoryInterface; |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Display the specified resource. |
|
21
|
|
|
* |
|
22
|
|
|
* @param \Pratiksh\Adminetic\Models\Admin\Profile $profile |
|
23
|
|
|
* @return \Illuminate\Http\Response |
|
24
|
|
|
*/ |
|
25
|
|
|
public function show(Profile $profile) |
|
26
|
|
|
{ |
|
27
|
|
|
return $this->checkAuthorization($profile) ? view('adminetic::admin.profile.show', $this->profileRepositoryInterface->showProfile($profile)) : abort(403); |
|
|
|
|
|
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Show the form for editing the specified resource. |
|
32
|
|
|
* |
|
33
|
|
|
* @param \Pratiksh\Adminetic\Models\Admin\Profile $profile |
|
34
|
|
|
* @return \Illuminate\Http\Response |
|
35
|
|
|
*/ |
|
36
|
|
|
public function edit(Profile $profile) |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->checkAuthorization($profile) ? view('adminetic::admin.profile.edit', $this->profileRepositoryInterface->editProfile($profile)) : abort(403); |
|
|
|
|
|
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Update the specified resource in storage. |
|
43
|
|
|
* |
|
44
|
|
|
* @param \Pratiksh\Adminetic\Http\Requests\ProfileRequest $request |
|
45
|
|
|
* @param \Pratiksh\Adminetic\Models\Admin\Profile $profile |
|
46
|
|
|
* @return \Illuminate\Http\Response |
|
47
|
|
|
*/ |
|
48
|
|
|
public function update(ProfileRequest $request, Profile $profile) |
|
49
|
|
|
{ |
|
50
|
|
|
if ($this->checkAuthorization($profile)) { |
|
51
|
|
|
$this->profileRepositoryInterface->updateProfile($request, $profile); |
|
52
|
|
|
|
|
53
|
|
|
return redirect(adminEditRoute('profile', $profile->id))->withInfo('Profile Updated Sucessfully'); |
|
|
|
|
|
|
54
|
|
|
} else { |
|
55
|
|
|
return abort(403); |
|
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Check Authorization. |
|
61
|
|
|
*/ |
|
62
|
|
|
protected function checkAuthorization(Profile $profile) |
|
63
|
|
|
{ |
|
64
|
|
|
return auth()->user()->hasRole('superadmin') || auth()->user()->hasRole('admin') || auth()->user()->id == $profile->user_id; |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|
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