<commit_before><?php

namespace Coyote;

use Illuminate\Database\Eloquent\Model;

/**
 * @property int $id
 * @property int $parent_id
 * @property int $topics
 * @property int $posts
 * @property int $order
 * @property int $last_post_id
 * @property int $is_locked
 * @property int $require_tag
 * @property int $enable_prune
 * @property int $enable_reputation
 * @property int $enable_anonymous
 * @property int $prune_days
 * @property int $prune_last
 * @property string $name
 * @property string $slug
 * @property string $title
 * @property string $description
 * @property string $section
 * @property string $url
 */
class Forum extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'parent_id',
        'name',
        'slug',
        'description',
        'section',
        'url',
        'is_locked',
        'require_tag',
        'enable_reputation',
        'enable_anonymous'
    ];

    /**
     * @var bool
     */
    public $timestamps = false;

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

        static::saving(function ($model) {
            if (empty($model->parent_id)) {
                $model->parent_id = null;
            }
        });
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function access()
    {
        return $this->hasMany('Coyote\Forum\Access');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
     */
    public function permissions()
    {
        return $this->hasMany('Coyote\Forum\Permission');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function tracks()
    {
        return $this->hasMany('Coyote\Forum\Track');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\MorphOne
     */
    public function page()
    {
        return $this->morphOne('Coyote\Page', 'content');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function order()
    {
        return $this->hasMany('Coyote\Forum\Order');
    }

    /**<commit_msg>poprawiony bug zwiazany z ustalaniem slug przy tworzeniu podkategorii<commit_after><?php

namespace Coyote;

use Illuminate\Database\Eloquent\Model;

/**
 * @property int $id
 * @property int $parent_id
 * @property int $topics
 * @property int $posts
 * @property int $order
 * @property int $last_post_id
 * @property int $is_locked
 * @property int $require_tag
 * @property int $enable_prune
 * @property int $enable_reputation
 * @property int $enable_anonymous
 * @property int $prune_days
 * @property int $prune_last
 * @property string $name
 * @property string $slug
 * @property string $title
 * @property string $description
 * @property string $section
 * @property string $url
 * @property Forum $parent
 */
class Forum extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'parent_id',
        'name',
        'slug',
        'description',
        'section',
        'url',
        'is_locked',
        'require_tag',
        'enable_reputation',
        'enable_anonymous'
    ];

    /**
     * @var bool
     */
    public $timestamps = false;

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

        static::saving(function (Forum $model) {
            if (empty($model->parent_id)) {
                $model->parent_id = null;
            } else {
                $model->slug = $model->parent->slug . '/' . $model->slug;
            }
        });
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function access()
    {
        return $this->hasMany('Coyote\Forum\Access');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
     */
    public function permissions()
    {
        return $this->hasMany('Coyote\Forum\Permission');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function tracks()
    {
        return $this->hasMany('Coyote\Forum\Track');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\MorphOne
     */
    public function page()
    {
        return $this->morphOne('Coyote\Page', 'content');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function order()
    {
        return $this->hasMany('Coyote\Forum\Order');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function parent()
    {
        return $this->hasOne('Coyote\Forum', 'id', 'parent_id');
    }

    /**
{'fraction_non_alphanumeric': 0.13543638275499476, 'fraction_numerical': 0.0, 'mean_word_length': 2.226594301221167, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '72158', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1484, 'n_words': 301}