%PDF- %PDF-
| Direktori : /home2/rezakur1/dashboard.rezakurnia.com/dashboard-rezakurnia/app/Models/ |
| Current File : //home2/rezakur1/dashboard.rezakurnia.com/dashboard-rezakurnia/app/Models/Article.php |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
protected $table = 'articles';
protected $fillable = [
'article_category_id',
'author_id',
'title',
'slug',
'excerpt',
'content',
'body',
'lens_5w1h',
'cover_image',
'meta_title',
'meta_description',
'read_time',
'published_at',
'is_published',
'is_featured',
'is_archived',
'is_deleted',
'is_trashed',
'like_count',
'share_count',
'comment_count',
'bookmark_count',
'avg_read_time',
'view_count',
];
protected $casts = [
'content' => 'array',
'body' => 'array',
'lens_5w1h' => 'array',
'published_at' => 'datetime',
'is_published' => 'boolean',
'is_featured' => 'boolean',
'is_archived' => 'boolean',
'is_deleted' => 'boolean',
'is_trashed' => 'boolean',
'read_time' => 'integer',
'avg_read_time' => 'integer',
];
/*
|--------------------------------------------------------------------------
| RELATIONSHIP
|--------------------------------------------------------------------------
*/
public function categoryArticle()
{
return $this->belongsTo(ArticleCategories::class, 'article_category_id');
}
public function author()
{
return $this->belongsTo(User::class, 'author_id');
}
public function tags()
{
return $this->belongsToMany(
ArticleTags::class,
'article_tag_relations',
'article_id',
'article_tag_id'
);
}
public function tagRelations()
{
return $this->hasMany(
ArticleTagRelations::class,
'article_id'
);
}
}