Completed
Push — master ( 30a987...803025 )
by Sheela
09:36
created

AccessToken   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 4 1
A setAttribute() 0 7 3
1
<?php
2
3
namespace SET;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
8
9
class AccessToken extends Model
10
{
11
    //
12
    protected $table = 'access_tokens';
13
   
14
    protected $fillable = ['user_id','sipr_issued','sipr_issue_date', 'sipr_expiration_date', 'sipr_return_date', 'cac_issued', 'cac_issue_date','cac_expiration_date', 'cac_return_date'];
15
    
16
    
17
18
    public function user()
19
    {
20
        return $this->belongsTo('SET\User');
21
    }
22
23
    /**
24
     * Store empty values as null in the DB.
25
     *
26
     * @param string $key
27
     * @param mixed  $value
28
     *
29
     * @return $this
30
     */
31
    public function setAttribute($key, $value)
32
    {
33
        if (is_scalar($value) && $value === '') {
34
            $value = null;
35
        }
36
        return parent::setAttribute($key, $value);
37
    }
38
39
}
40