| Total Complexity | 4 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Content extends Model |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The attributes that are mass assignable. |
||
| 11 | * |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | protected $fillable = [ |
||
| 15 | 'title', 'text', 'image', 'link', 'published_at' |
||
| 16 | ]; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Content belongsTo . |
||
| 20 | * |
||
| 21 | * @return \Illuminate\Database\Eloquent\Relations\belongsTo |
||
| 22 | */ |
||
| 23 | public function user() |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Content belongsToMany . |
||
| 30 | * |
||
| 31 | * @return \Illuminate\Database\Eloquent\Relations\belongsToMany |
||
| 32 | */ |
||
| 33 | public function likes() |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Comment has many . |
||
| 40 | * |
||
| 41 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
| 42 | */ |
||
| 43 | public function comments() |
||
| 44 | { |
||
| 45 | // hasMany(RelatedModel, foreignKeyOnRelatedModel = user_id, localKey = id) |
||
| 46 | return $this->hasMany(Comment::class); |
||
| 47 | } |
||
| 48 | |||
| 49 | public function getPublishedAtAttribute($value) |
||
| 53 | } |
||
| 54 | } |
||
| 55 |