self::CATE_HELP, 'agreement'=> self::CATE_AGREEMENT, 'health'=> self::CATE_HEALTH, ]; protected $casts = [ 'is_show' => 'boolean', 'is_recommend' => 'boolean', ]; public function hasRead(User $user) { return ArticlePointsLog::where('user_id', $user->id)->where('article_id', $this->id)->whereDate('created_at', now())->exists(); } public function category() { return $this->belongsTo(ArticleCategory::class, 'category_id'); } public function likesInfo() { return $this->hasMany(ArticleLikesLog::class, 'article_id'); } }