Completed
Push — master ( 7fd3dc...2f5e5e )
by Sherif
10:09
created

OauthClientsController::revoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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|exists:users,id',
27
        'revoked'  => 'boolean'
28
    ];
29
30
    /**
31
     * Revoke the given client.
32
     *
33
     * @param  integer  $clientId Id of the client
34
     * @return \Illuminate\Http\Response
35
     */
36
    public function revoke($clientId)
37
    {
38
        return \Response::json($this->repo->revoke($clientId), 200);
39
    }
40
41
    /**
42
     * Un revoke the given client.
43
     *
44
     * @param  integer  $clientId Id of the client
45
     * @return \Illuminate\Http\Response
46
     */
47
    public function unRevoke($clientId)
48
    {
49
        return \Response::json($this->repo->unRevoke($clientId), 200);
50
    }
51
}
52