<commit_before><?php namespace App;

use Illuminate\Database\Eloquent\Model;

/**
 * Фотография
 *
 * @property integer $id
 * @property integer $user_id
 * @property integer $rel_id
 * @property string  $rel_type
 * @property string  $slug
 * @property string  $lat
 * @property string  $lon
 * @property integer $views
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 *
 * @property \App\User $user
 */
class Photo extends Model
{
    protected $guarded = ['rel_id', 'rel_type', 'created_at', 'updated_at', 'goto'];
    protected $perPage = 50;

    public function rel()
    {
        return $this->morphTo();
    }

    public function tags()
    {
        return $this->morphToMany(Tag::class, 'rel', 'taggable')
            ->orderBy(Tag::titleField());
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function scopeApplyFilter($query, $filter = null)
    {
        if (is_null($filter)) {
            return $query;
        }

        if ($filter === 'no-tags') {
            return $query->doesntHave('tags');
        }

        return $query;
    }

    public function scopeForTag($query, $id = null)
    {
        if (is_null($id)) {
            return $query;
        }

        return $query->whereHas('tags', function ($query) use ($id) {
            $query->where('tag_id', $id);
        });
    }

    public function scopeForTrip($query, $id = null)
    {
        if (is_null($id)) {
            return $query;
        }

        return $query->where('rel_id', $id)->where('rel_type', 'Trip');
    }

    public function scopeForTrips($query, $ids = [])
    {
        if (empty($ids)) {
            return $query;
        }

        return $query->whereIn('rel_id', $ids)->where('rel_type', 'Trip');
    }

    public function breadcrumb()
    {
        return $this->slug;
    }

    public function isOnMap()
    {
        return $this->lat && $this->lon;
    }

    public function originalUrl()
    {
        return "https://life.ivacuum.ru/{$this->slug}";
    }

    public function thumbnailUrl()
    {
        return "https://life.ivacuum.ru/-/400x300/{$this->slug}";
    }

    public function www()
    {
        return action('Photos@show', $this->id);
    }
}<commit_msg>Разбиение пути к фото пробелами<commit_after><?php namespace App;

use Illuminate\Database\Eloquent\Model;

/**
 * Фотография
 *
 * @property integer $id
 * @property integer $user_id
 * @property integer $rel_id
 * @property string  $rel_type
 * @property string  $slug
 * @property string  $lat
 * @property string  $lon
 * @property integer $views
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 *
 * @property \App\User $user
 */
class Photo extends Model
{
    protected $guarded = ['rel_id', 'rel_type', 'created_at', 'updated_at', 'goto'];
    protected $perPage = 50;

    public function rel()
    {
        return $this->morphTo();
    }

    public function tags()
    {
        return $this->morphToMany(Tag::class, 'rel', 'taggable')
            ->orderBy(Tag::titleField());
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function scopeApplyFilter($query, $filter = null)
    {
        if (is_null($filter)) {
            return $query;
        }

        if ($filter === 'no-tags') {
            return $query->doesntHave('tags');
        }

        return $query;
    }

    public function scopeForTag($query, $id = null)
    {
        if (is_null($id)) {
            return $query;
        }

        return $query->whereHas('tags', function ($query) use ($id) {
            $query->where('tag_id', $id);
        });
    }

    public function scopeForTrip($query, $id = null)
    {
        if (is_null($id)) {
            return $query;
        }

        return $query->where('rel_id', $id)->where('rel_type', 'Trip');
    }

    public function scopeForTrips($query, $ids = [])
    {
        if (empty($ids)) {
            return $query;
        }

        return $query->whereIn('rel_id', $ids)->where('rel_type', 'Trip');
    }

    public function breadcrumb()
    {
        return str_replace('/', ' / ', $this->slug);
    }

    public function isOnMap()
    {
        return $this->lat && $this->lon;
    }

    public function originalUrl()
    {
        return "https://life.ivacuum.ru/{$this->slug}";
    }

    public function thumbnailUrl()
    {
        return "https://life.ivacuum.ru/-/400x300/{$this->slug}";
    }

    public function www()
    {
        return action('Photos@show', $this->id);
    }
}
{'fraction_non_alphanumeric': 0.15767814598223956, 'fraction_numerical': 0.0034654537578514186, 'mean_word_length': 2.191430545957153, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '172926', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1478, 'n_words': 317}