Completed
Push — master ( 97e3cb...a7be99 )
by Sherif
02:45
created

OauthClientsController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A revoke() 0 4 1
A regenerateSecret() 0 4 1
1
<?php
2
namespace App\Modules\V1\Acl\Http\Controllers;
3
4
use Illuminate\Foundation\Http\FormRequest;
5
use App\Modules\V1\Core\Http\Controllers\BaseApiController;
6
use Illuminate\Http\Request;
7
8
9
class OauthClientsController extends BaseApiController
10
{
11
    /**
12
     * The name of the model that is used by the base api controller 
13
     * to preform actions like (add, edit ... etc).
14
     * @var string
15
     */
16
    protected $model               = 'oauthClients';
17
18
    /**
19
     * The validations rules used by the base api controller
20
     * to check before add.
21
     * @var array
22
     */
23
    protected $validationRules  = [
24
        'name'                   => 'required|max:255',
25
        'redirect'               => 'required|url',
26
        'user_id'                => 'required|array|exists:users,id',
27
        'personal_access_client' => 'boolean',
28
        'password_client'        => 'boolean',
29
        'revoked'                => 'boolean'
30
    ];
31
32
    /**
33
     * Revoke the given client.
34
     *
35
     * @param  integer  $clientId
36
     * @return \Illuminate\Http\Response
37
     */
38
    public function revoke($clientId)
39
    {
40
        return \Response::json($this->repo->revoke($clientId), 200);
41
    }
42
43
    /**
44
     * Regenerate seceret for the given client.
45
     *
46
     * @param  integer  $clientId
47
     * @return \Illuminate\Http\Response
48
     */
49
    public function regenerateSecret($clientId)
50
    {
51
        return \Response::json($this->repo->regenerateSecret($clientId), 200);
52
    }
53
}
54