Skip to content

Latest commit

 

History

History
113 lines (77 loc) · 1.97 KB

File metadata and controls

113 lines (77 loc) · 1.97 KB

🚀 Usage

👤 Create a profile

$profile = $user->createPersona([
    'display_name' => 'Nick',
    'headline' => 'Laravel Package Builder',
    'motto' => 'Build useful things.',
    'bio' => 'Building useful Laravel packages.',
    'location' => 'Kansas',
    'website_url' => 'https://example.com',
    'is_public' => true,
    'published_at' => now(),
]);

👁️ Check visibility

$profile->isVisible();

$visibleProfiles = Persona::visible()->get();

Visibility follows persona.visibility.require_published_at.

✏️ Access and update a profile

$profile = $user->persona;

$user->hasPersona();

$user->updatePersona([
    'headline' => 'Open-source Laravel Developer',
]);

🌐 Public profile URL

$url = $profile->url();

$url = $user->personaUrl();

🖼️ Avatar and banner URLs

$avatarUrl = $profile->avatarUrl();

$bannerUrl = $profile->bannerUrl();

🏷️ Username tokens

$tokens = $profile->usernameTokens();

$profile->canChangeUsername();

$profile->nextUsernameTokenAt();

$profile->changeUsername('signal-nick');

Skip token spending for an administrative change:

$profile->changeUsername(
    'signal-nick',
    spendToken: false
);

💬 Comments

$comment = $profile->addComment(
    $user,
    'Great profile.'
);

$reply = $comment->addReply(
    $otherUser,
    'Thank you.'
);

✏️ Edit a comment

$comment->edit('Updated comment.');

📌 Approve, pin, or delete

$comment->approve();

$comment->pin();

$comment->delete();

See 📖 Profile Comments for the complete comment API.

🛡️ Application validation

Configuration values such as profile field limits, link limits, allowed social platforms, and guest-comment preferences are intended for the consuming application's form requests and UI.

Persona does not automatically validate arbitrary profile assignments or register comment-management routes.