Completed
Push — master ( 2d22de...e2d103 )
by Sherif
02:14
created

OauthClient   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getCreatedAtAttribute() 0 4 1
A getUpdatedAtAttribute() 0 4 1
A user() 0 4 1
A boot() 0 5 1
1
<?php
2
3
namespace App\Modules\Acl;
4
5
use Laravel\Passport\Client;
6
7
class OauthClient extends Client
8
{
9
    protected $dates    = ['created_at', 'updated_at'];
10
    protected $fillable = ['name', 'redirect', 'user_id', 'personal_access_client', 'password_client', 'revoked'];
11
    public $searchable  = ['name'];
12
    
13
    public function getCreatedAtAttribute($value)
14
    {
15
        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
16
    }
17
18
    public function getUpdatedAtAttribute($value)
19
    {
20
        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
21
    }
22
    
23
    public function user()
24
    {
25
        return $this->belongsTo('App\Modules\Acl\AclUser');
26
    }
27
    
28
    public static function boot()
29
    {
30
        parent::boot();
31
        OauthClient::observe(\App::make('App\Modules\Acl\ModelObservers\OauthClientObserver'));
32
    }
33
}
34