Completed
Push — master ( 0dfd17...a38508 )
by Sherif
02:04
created

DummyModel::getUpdatedAtAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php namespace App\Modules\DummyModule;
2
3
use Illuminate\Database\Eloquent\Model;
4
use Illuminate\Database\Eloquent\SoftDeletes;
5
6 View Code Duplication
class DummyModel extends Model
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
7
{
8
    use SoftDeletes;
9
    protected $table    = 'DummyTableName';
10
    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
    protected $hidden   = ['deleted_at'];
12
    protected $guarded  = ['id'];
13
    protected $fillable = []; // Add attributes here
14
    public $searchable  = []; // Add earchable attributes here
15
    
16
    public function getCreatedAtAttribute($value)
17
    {
18
        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
19
    }
20
21
    public function getUpdatedAtAttribute($value)
22
    {
23
        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
24
    }
25
26
    public function getDeletedAtAttribute($value)
27
    {
28
        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
29
    }
30
    
31
    public static function boot()
32
    {
33
        parent::boot();
34
        DummyModel::observe(\App::make('App\Modules\DummyModule\ModelObservers\DummyObserver'));
35
    }
36
}
37