Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posting: drafts #423

Open
agentphoenix opened this issue Dec 16, 2024 · 0 comments
Open

Posting: drafts #423

agentphoenix opened this issue Dec 16, 2024 · 0 comments

Comments

@agentphoenix
Copy link
Member

agentphoenix commented Dec 16, 2024

  • post_draft
    • id
    • post_id
    • user_id
    • title
    • content
    • day
    • time
    • location
    • word_count
    • created_at
    • updated_at
  • posts
    • draft_id
protected $with = ['currentDraft'];

public function drafts(): HasMany
{
    return $this->hasMany(PostDraft::class);
}

public function currentDraft(): HasOne
{
    return $this->hasOne(PostDraft::class, 'draft_id');
}

public function title(): Attribute
{
    return Attribute::make(
        get: fn () => $this->currentDraft?->title
    );
}

$post->title
@agentphoenix agentphoenix converted this from a draft issue Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant