<commit_before><?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use DB;

class Article extends Model
{
	protected $fillable = ['status', 'subject', 'url', 'image_url', 'content', 'published'];
	protected $table = 'articles';
	protected $appends = array('category_id');

	public function feed()
	{
		return $this->belongsTo('App\Feed');
	}

	public function getCategoryIdAttribute()
	{
		return DB::table('articles')->join('feeds', 'articles.feed_id', '=', 'feeds.id')->where('articles.id', $this->id)->max('feeds.category_id');
	}
}<commit_msg>add hotness count attribute to article<commit_after><?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use DB;

class Article extends Model
{
	protected $fillable = ['status', 'subject', 'url', 'image_url', 'content', 'published'];
	protected $table = 'articles';
	protected $appends = array('category_id','hotness_count');

	public function feed()
	{
		return $this->belongsTo('App\Feed');
	}

	public function getCategoryIdAttribute()
	{
		return DB::table('articles')->join('feeds', 'articles.feed_id', '=', 'feeds.id')->where('articles.id', $this->id)->max('feeds.category_id');
	}

	public function getHotnessCountAttribute()
	{
		return DB::table('hotlinks')->where('hotlink', $this->url)->where('feed_id', '!=' , $this->feed_id)->count();
	}
}
{'fraction_non_alphanumeric': 0.1946969696969697, 'fraction_numerical': 0.0, 'mean_word_length': 6.179347826086956, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2044240', 'n_tokens_mistral': 449, 'n_tokens_neox': 435, 'n_words': 88}