pratiksh404 /
adminetic
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Pratiksh\Adminetic\Http\Controllers\Admin; |
||
| 4 | |||
| 5 | use App\Http\Controllers\Controller; |
||
|
0 ignored issues
–
show
|
|||
| 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); |
||
|
0 ignored issues
–
show
Are you sure the usage of
abort(403) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 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); |
||
|
0 ignored issues
–
show
Are you sure the usage of
abort(403) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 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'); |
||
|
0 ignored issues
–
show
|
|||
| 54 | } else { |
||
| 55 | return abort(403); |
||
|
0 ignored issues
–
show
Are you sure the usage of
abort(403) is correct as it seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 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