Tag blog posts and sign them with a member
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>
This commit is contained in:
@@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
@@ -26,7 +27,7 @@ use Spatie\Translatable\HasTranslations;
|
||||
* @property array<string, string> $slug
|
||||
*/
|
||||
#[Fillable([
|
||||
'category_id', 'author_id', 'title', 'slug', 'excerpt', 'body',
|
||||
'category_id', 'author_id', 'byline_member_id', 'title', 'slug', 'excerpt', 'body',
|
||||
'meta_title', 'meta_description', 'status', 'featured_image',
|
||||
'featured_image_alt', 'is_featured', 'published_at', 'unpublish_at',
|
||||
])]
|
||||
@@ -146,6 +147,25 @@ class Page extends Model
|
||||
return $this->belongsTo(User::class, 'author_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Who signs it on the site: a member, with a profile to link to. Not the
|
||||
* account that typed it in, which is `author` and stays in the panel.
|
||||
*
|
||||
* @return BelongsTo<Member, $this>
|
||||
*/
|
||||
public function byline(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Member::class, 'byline_member_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsToMany<Tag, $this>
|
||||
*/
|
||||
public function tags(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Tag::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Publicly visible pages: published and not scheduled for the future.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user