Completed
Push — master ( b84639...0da43a )
by Mahmoud
03:35
created

DeleteUserRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 6 1
A authorize() 0 4 1
1
<?php
2
3
namespace App\Containers\User\UI\API\Requests;
4
5
use Illuminate\Contracts\Auth\Access\Gate;
6
use App\Containers\User\Models\User;
7
use App\Port\Request\Abstracts\Request;
8
9
/**
10
 * Class DeleteUserRequest.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class DeleteUserRequest extends Request
15
{
16
17
    /**
18
     * Get the validation rules that apply to the request.
19
     *
20
     * @return array
21
     */
22
    public function rules()
23
    {
24
        return [
25
26
        ];
27
    }
28
29
    /**
30
     * Determine if the user is authorized to make this request.
31
     *
32
     * @param \Illuminate\Contracts\Auth\Access\Gate $gate
33
     *
34
     * @return bool
35
     */
36
    public function authorize(Gate $gate, GetAuthenticatedUserTask $getAuthenticatedUserTask)
37
    {
38
        return $gate->getPolicyFor(User::class)->update($this->user(), $getAuthenticatedUserTask->run()->id);
0 ignored issues
show
Bug introduced by
The method getPolicyFor() does not exist on Illuminate\Contracts\Auth\Access\Gate. Did you maybe mean policy()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
39
    }
40
}
41