Passed
Push — master ( 748f3d...b934ad )
by Dan Michael O.
05:47
created

LibraryIp::serializeDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App;
4
5
use DateTimeInterface;
6
use Illuminate\Database\Eloquent\Model;
7
8
class LibraryIp extends Model
9
{
10
    /**
11
     * The database table used by the model.
12
     *
13
     * @var string
14
     */
15
    protected $table = 'library_ips';
16
17
    /**
18
     * The attributes that are mass assignable.
19
     *
20
     * @var array
21
     */
22
    protected $fillable = ['library_id', 'ip'];
23
24
    /**
25
     * Prepare a date for array / JSON serialization.
26
     *
27
     * @param  \DateTimeInterface  $date
28
     * @return string
29
     */
30
    protected function serializeDate(DateTimeInterface $date)
31
    {
32
        return $date->format('Y-m-d H:i:s');
33
    }
34
35
    public function library()
36
    {
37
        return $this->belongsTo(Library::class);
38
    }
39
}
40