<commit_before><?php namespace vendocrat\Taxonomies\Models;

use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Term extends Model implements
	SluggableInterface
{
	use SluggableTrait;
	use SoftDeletes;

	/**
	 * @inheritdoc
	 */
	protected $table = 'terms';

	/**
	 * @inheritdoc
	 */
	protected $fillable = [
		'name_de',
		'name_en',
		'name_it',
		'slug',
	];

	/**
	 * @inheritdoc
	 */
	protected $dates = ['deleted_at'];

	/**
	 * Sluggable
	 *
	 * @var array
	 */
	protected $sluggable = [
		'build_from' => 'name',
		'save_to'    => 'slug',
	];

	/**
	 * @return \Illuminate\Database\Eloquent\Relations\MorphMany
	 */
	public function taxable() {
		return $this->morphMany(Taxable::class, 'taxable');
	}

	/**
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
	 */
	public function taxonomies() {
		return $this->hasMany(Taxonomy::class);
	}

	/**
	 * Get Name Attribute for slugging
	 *
	 * @return mixed
	 */
	public function getNameAttribute() {
		if ( $this->name_en ) {
			return $this->name_en;
		} elseif ( $this->name_de ) {
			return $this->name_de;
		} elseif ( $this->name_it ) {
			return $this->name_it;
		}

		return null;
	}

	/**
	 * Get Display Name
	 *
	 * @param  string $locale
	 * @param  int    $limit
	 * @return mixed
	 */
	public function getDisplayName( $locale = '', $limit = 0 ) {
		$locale = $locale ?: app()->getLocale();

		switch ( $locale ) {
			case 'en' :
			default :
				$name = $this->name_en;
				break;

			case 'de' :
				$name = $this->name_de;
				break;

			case 'it' :
				$name = $this->name_it;
				break;
		}

		return $limit > 0 ? str_limit($name, $limit) : $name;
	}


}<commit_msg>Update sluggable<commit_after><?php namespace vendocrat\Taxonomies\Models;

use Cviebrock\EloquentSluggable\Sluggable;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Term extends Model {
	use Sluggable;
	use SoftDeletes;

	/**
	 * @inheritdoc
	 */
	protected $table = 'terms';

	/**
	 * @inheritdoc
	 */
	protected $fillable = [
		'name_de',
		'name_en',
		'name_it',
		'slug',
	];

	/**
	 * @inheritdoc
	 */
	protected $dates = ['deleted_at'];

	/**
	 * @return \Illuminate\Database\Eloquent\Relations\MorphMany
	 */
	public function taxable() {
		return $this->morphMany(Taxable::class, 'taxable');
	}

	/**
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
	 */
	public function taxonomies() {
		return $this->hasMany(Taxonomy::class);
	}

	/**
	 * Get Name Attribute for slugging
	 *
	 * @return mixed
	 */
	public function getNameAttribute() {
		if ( $this->name_en ) {
			return $this->name_en;
		} elseif ( $this->name_de ) {
			return $this->name_de;
		} elseif ( $this->name_it ) {
			return $this->name_it;
		}

		return null;
	}

	/**
	 * Get Display Name
	 *
	 * @param  string $locale
	 * @param  int    $limit
	 * @return mixed
	 */
	public function getDisplayName( $locale = '', $limit = 0 ) {
		$locale = $locale ?: app()->getLocale();

		switch ( $locale ) {
			case 'en' :
			default :
				$name = $this->name_en;
				break;

			case 'de' :
				$name = $this->name_de;
				break;

			case 'it' :
				$name = $this->name_it;
				break;
		}

		return $limit > 0 ? str_limit($name, $limit) : $name;
	}

    /**
     * Return the sluggable configuration array for this model.
     *
     * @return array
     */
    public function sluggable()
    {
        return [
            'slug' => [
                'source' => 'name'
            ]
        ];
    }
}
{'fraction_non_alphanumeric': 0.157923799006074, 'fraction_numerical': 0.0011043622308117063, 'mean_word_length': 2.785788923719958, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '2599134', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1308, 'n_words': 261}