<commit_before><?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Nicolaslopezj\Searchable\SearchableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;

class Playlist extends Model implements SluggableInterface {

    use SluggableTrait;
    use SearchableTrait;
    use SoftDeletes;

    protected $table = 'playlists';

    protected $sluggable = [];

    protected $searchable = [
        'columns' => [
            'playlists.name' => 10
        ]
    ];

    /**
     * Get a playlist from slug
     *
     * @param $query
     * @param $slug
     *
     * @return \App\Playlist
     */
    public function scopeFindBySlugOrFail($query, $slug)
    {
        return $query->where('slug', $slug)
            ->firstOrFail();
    }

    /**
     * Is the playlist a fork of another playlist?
     *
     * @return bool
     */
    public function isFork()
    {
        return !is_null($this->forkParent);
    }

    /**
     * Has the playlist been updated?
     *
     * @return bool
     */
    public function hasBeenUpdated()
    {
        return $this->updated_at > $this->created_at;
    }

    public function songs()
    {
        return $this->belongsToMany('App\Song');
    }

    public function forkParent()
    {
        return $this->belongsTo('App\Playlist', 'fork_parent_id');
    }

    public function forks()
    {
        return $this->hasMany('App\Playlist', 'fork_parent_id');
    }

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

}
<commit_msg>Slimmed down search a bit<commit_after><?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Nicolaslopezj\Searchable\SearchableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;

class Playlist extends Model implements SluggableInterface {

    use SluggableTrait;
    use SearchableTrait;
    use SoftDeletes;

    protected $table = 'playlists';

    protected $sluggable = [];

    protected $searchable = [
        'columns' => [
            'name' => 10
        ]
    ];

    /**
     * Get a playlist from slug
     *
     * @param $query
     * @param $slug
     *
     * @return \App\Playlist
     */
    public function scopeFindBySlugOrFail($query, $slug)
    {
        return $query->where('slug', $slug)
            ->firstOrFail();
    }

    /**
     * Is the playlist a fork of another playlist?
     *
     * @return bool
     */
    public function isFork()
    {
        return !is_null($this->forkParent);
    }

    /**
     * Has the playlist been updated?
     *
     * @return bool
     */
    public function hasBeenUpdated()
    {
        return $this->updated_at > $this->created_at;
    }

    public function songs()
    {
        return $this->belongsToMany('App\Song');
    }

    public function forkParent()
    {
        return $this->belongsTo('App\Playlist', 'fork_parent_id');
    }

    public function forks()
    {
        return $this->hasMany('App\Playlist', 'fork_parent_id');
    }

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

}

{'fraction_non_alphanumeric': 0.11893054701905348, 'fraction_numerical': 0.001229256299938537, 'mean_word_length': 2.2945344129554655, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '3168206', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1041, 'n_words': 212}