<commit_before><?php namespace Antoniputra\Asmoyo\Categories;

use Antoniputra\Asmoyo\Cores\Entity;

class Category extends Entity {

	protected $table      	= 'categories';
	protected $fillable 	= ['photo_id', 'parent_id', 'title', 'slug', 'status', 'description'];
	protected $softDelete 	= true;

	protected $validationRules = [
        'title'		=> 'required',
        'slug'		=> 'required',
    ];

    public static function boot()
    {
        parent::boot();

        static::saved(function($category)
        {
            \Cache::tags('CategoryRepo')->flush();
        });

        static::deleted(function($category)
        {
            \Cache::tags('CategoryRepo')->flush();
        });
    }

    public function posts()
    {
        return $this->hasMany('Antoniputra\Asmoyo\Posts\Post');
    }
}<commit_msg>update category eloquent<commit_after><?php namespace Antoniputra\Asmoyo\Categories;

use Antoniputra\Asmoyo\Cores\Entity;

class Category extends Entity {

	protected $table      	= 'categories';
	protected $fillable 	= ['photo_id', 'parent_id', 'title', 'slug', 'status', 'description'];
	protected $softDelete 	= true;

    protected $validationRules = [
        'title'     => 'required|unique:categories',
        'slug'      => 'required|unique:categories',
    ];

	protected $validationEditRules = [
        'title'		=> 'required|unique:categories,<id>',
        'slug'		=> 'required|unique:categories,<id>',
    ];

    public function posts()
    {
        return $this->hasMany('Antoniputra\Asmoyo\Posts\Post');
    }
}
{'fraction_non_alphanumeric': 0.15562700964630224, 'fraction_numerical': 0.0, 'mean_word_length': 3.0103092783505154, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '3465', 'n_tokens_mistral': 491, 'n_tokens_neox': 477, 'n_words': 85}