Components

Profile

Basics

Using the Profile component, you can display a user's profile card with a logout button, a link to the profile, and an additional menu.

make(
?string $route = null,
?string $logOutRoute = null,
?Closure $avatar = null,
?Closure $nameOfUser = null,
?Closure $username = null,
bool $withBorder = false,
?string $guard = null,
)
  • $route - URL page with Profile,
  • $logOutRoute - URL for Logout,
  • $avatar - Avatar,
  • $nameOfUser - Name,
  • $username - Nickname,
  • $withBorder - Divider
  • $guard - Guard.
Profile::make()
<x-moonshine::layout.profile
route="/admin/profile"
log-out-route="/logout"
avatar="/vendor/moonshine/avatar.jpg"
name-of-user="Admin"
username="admin@getmoonshine.app"
>
</x-moonshine::layout.profile>

Avatar placeholder

Profile::make()->avatarPlaceholder('https://robohash.org/username.png')
Profile::make()->menu([
ActionButton::make('Dashboard', '/admin')->icon('home-modern'),
])
<x-moonshine::layout.profile
route="/admin/profile"
log-out-route="/logout"
avatar="/vendor/moonshine/avatar.jpg"
name-of-user="Admin"
username="admin@getmoonshine.app"
>
<x-slot:before></x-slot:before>
<x-slot:after></x-slot:after>
 
<x-slot:menu>
<ul class="dropdown-menu">
<li class="dropdown-menu-item p-2">
<x-moonshine::link-native href="/admin/profile">
Profile
</x-moonshine::link-native>
</li>
</ul>
</x-slot:menu>
</x-moonshine::layout.profile>