You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/app/Models/Hashtag.php

61 lines
2.2 KiB
PHTML

<?php
namespace App\Models;
4 days ago
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
4 days ago
use Illuminate\Support\Carbon;
4 days ago
/**
* @property int $id
* @property string $name
* @property string $slug
* @property int|null $can_trend
* @property int|null $can_search
* @property int $is_nsfw
* @property int $is_banned
4 days ago
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
4 days ago
* @property int|null $cached_count
4 days ago
* @property-read Collection<int, Status> $posts
4 days ago
* @property-read int|null $posts_count
4 days ago
*
4 days ago
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereCachedCount($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereCanSearch($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereCanTrend($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereIsBanned($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereIsNsfw($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Hashtag whereUpdatedAt($value)
4 days ago
*
4 days ago
* @mixin \Eloquent
*/
class Hashtag extends Model
{
public $fillable = ['name', 'slug'];
public function posts(): HasManyThrough
{
return $this->hasManyThrough(
9 months ago
Status::class,
StatusHashtag::class,
'hashtag_id',
'id',
'id',
'status_id'
);
}
public function url($suffix = ''): string
{
return config('routes.hashtag.base').$this->slug.$suffix;
}
}