Passed
Pull Request — master (#610)
by John
05:33
created

Announcement   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
dl 0
loc 22
rs 10
c 1
b 0
f 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContentParsedAttribute() 0 3 1
A getPostDateParsedAttribute() 0 3 1
A user() 0 3 1
1
<?php
2
3
namespace App\Models\Eloquent;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Announcement extends Model
8
{
9
    protected $table='announcement';
10
    protected $primaryKey='anid';
11
12
    protected $fillable=[
13
        'title', 'content'
14
    ];
15
16
    public function user()
17
    {
18
        return $this->belongsTo('App\Models\Eloquent\User', 'uid');
19
    }
20
21
    public function getPostDateParsedAttribute()
22
    {
23
        return formatHumanReadableTime($this->created_at);
24
    }
25
26
    public function getContentParsedAttribute()
27
    {
28
        return clean(convertMarkdownToHtml($this->content));
29
    }
30
}
31