Base_Model   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 9 1
1
<?php
2
3
namespace App\Models;
4
5
use Carbon\Carbon;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Support\Facades\Auth;
8
9
class Base_Model extends Model{
10
11
12
13
    public const CREATED_AT = 'created';
14
    public const UPDATED_AT = 'modified';
15
16
17
    public static function boot()
18
    {
19
20
        parent::boot();
21
        self::creating(function ($model) {
22
            $model->created = Carbon::now();
23
        });
24
        self::updating(function ($model) {
25
            $model->modified = Carbon::now();
26
        });
27
    }
28
29
}
30