Tags are named in every language and made from the page form; the byline is the member who signs a post on the site. The public API sends both, filters posts by tag and lists the tags in use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
951 B
PHP
38 lines
951 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\BumpsContentVersion;
|
|
use Database\Factories\TagFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Spatie\Translatable\HasTranslations;
|
|
|
|
/**
|
|
* What a post is about — `angular`, `accesibilidad` — so the blog can be read
|
|
* by subject. Named in every language, like a category.
|
|
*/
|
|
#[Fillable(['name', 'slug'])]
|
|
class Tag extends Model
|
|
{
|
|
/** @use HasFactory<TagFactory> */
|
|
use BumpsContentVersion, HasFactory, HasTranslations;
|
|
|
|
/**
|
|
* @var array<int, string>
|
|
*/
|
|
public array $translatable = ['name', 'slug'];
|
|
|
|
/**
|
|
* @return BelongsToMany<Page, $this>
|
|
*/
|
|
public function pages(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Page::class);
|
|
}
|
|
}
|