Passed
Pull Request — master (#610)
by John
22:48
created

ImageHosting::user()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace App\Models\Eloquent\Tool;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Support\Facades\DB;
7
8
class ImageHosting extends Model
9
{
10
    protected $table='image_hostings';
11
    protected $primaryKey='id';
12
13
    protected $fillable=[
14
        'user_id', 'relative_path'
15
    ];
16
17
    public function user()
18
    {
19
        return $this->belongsTo('App\Models\Eloquent\User');
20
    }
21
22
    public function getAbsolutePathAttribute()
23
    {
24
        return url($this->relative_path);
25
    }
26
}
27