'datetime', ]; public function tags() { return $this->belongsToMany(Tag::class)->withTimestamps(); } public function comments() { return $this->hasMany(Comment::class, 'target_id') ->where('target_type', 'article'); } public function scopePublished($query) { return $query->where('status', 'published'); } }