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

OauthClientRepository::unRevoke()   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 namespace App\Modules\V1\Acl\Repositories;
2
3
use App\Modules\V1\Core\AbstractRepositories\AbstractRepository;
4
5
class OauthClientRepository extends AbstractRepository
6
{
7
    /**
8
     * Return the model full namespace.
9
     * 
10
     * @return string
11
     */
12
    protected function getModel()
13
    {
14
        return 'App\Modules\V1\Acl\OauthClient';
15
    }
16
17
    /**
18
     * Revoke the given client.
19
     *
20
     * @param  integer  $clientId
21
     * @return void
22
     */
23
    public function revoke($clientId)
24
    {
25
        $client = $this->find($clientId);
26
        $client->tokens()->update(['revoked' => true]);
27
        $this->save(['id'=> $clientId, 'revoked' => true]);
28
    }
29
30
    /**
31
     * Un revoke the given client.
32
     *
33
     * @param  integer  $clientId
34
     * @return void
35
     */
36
    public function unRevoke($clientId)
37
    {
38
        $this->save(['id'=> $clientId, 'revoked' => false]);
39
    }
40
}
41