The system component Profile is used to display information about an authorized user in MoonShine.
You can create a Profile using the static method make() class Profile.
    make(
    ?string $route = null,
    ?string $logOutRoute = null,
    Closure|false|null|string $avatar = null,
    Closure|null|string $nameOfUser = null,
    Closure|null|string $username = null,
    bool $withBorder = false,
    ?string $guard = null
)
    
    make(
    ?string $route = null,
    ?string $logOutRoute = null,
    Closure|false|null|string $avatar = null,
    Closure|null|string $nameOfUser = null,
    Closure|null|string $username = null,
    bool $withBorder = false,
    ?string $guard = null
)
make(
    ?string $route = null,
    ?string $logOutRoute = null,
    Closure|false|null|string $avatar = null,
    Closure|null|string $nameOfUser = null,
    Closure|null|string $username = null,
    bool $withBorder = false,
    ?string $guard = null
)
make(
    ?string $route = null,
    ?string $logOutRoute = null,
    Closure|false|null|string $avatar = null,
    Closure|null|string $nameOfUser = null,
    Closure|null|string $username = null,
    bool $withBorder = false,
    ?string $guard = null
)
make(
    ?string $route = null,
    ?string $logOutRoute = null,
    Closure|false|null|string $avatar = null,
    Closure|null|string $nameOfUser = null,
    Closure|null|string $username = null,
    bool $withBorder = false,
    ?string $guard = null
)
 
- route- profile page route,
- logOutRoute- route for logout
- avatar- user avatar
- nameOfUser- user name
- username- username (email|login|tel ...)
- withBorder- split before the component
- guard- used by Guard for user authorization.
    namespace App\MoonShine;
use MoonShine\Components\Layout\LayoutBlock;
use MoonShine\Components\Layout\LayoutBuilder;
use MoonShine\Components\Layout\Menu;
use MoonShine\Components\Layout\Profile;
use MoonShine\Components\Layout\Sidebar;
use MoonShine\Contracts\MoonShineLayoutContract;
final class MoonShineLayout implements MoonShineLayoutContract
{
    public static function build(): LayoutBuilder
    {
        return LayoutBuilder::make([
            Sidebar::make([
                Menu::make()->customAttributes(['class' => 'mt-2']),
                Profile::make(withBorder: true)
            ]),
                    ]);
    }
}
    
    namespace App\MoonShine;
 
use MoonShine\Components\Layout\LayoutBlock;
use MoonShine\Components\Layout\LayoutBuilder;
use MoonShine\Components\Layout\Menu;
use MoonShine\Components\Layout\Profile;
use MoonShine\Components\Layout\Sidebar;
use MoonShine\Contracts\MoonShineLayoutContract;
 
final class MoonShineLayout implements MoonShineLayoutContract
{
    public static function build(): LayoutBuilder
    {
        return LayoutBuilder::make([
            Sidebar::make([
                Menu::make()->customAttributes(['class' => 'mt-2']),
                Profile::make(withBorder: true)
            ]),
 
            //...
        ]);
    }
}
namespace App\MoonShine;
use MoonShine\Components\Layout\LayoutBlock;
use MoonShine\Components\Layout\LayoutBuilder;
use MoonShine\Components\Layout\Menu;
use MoonShine\Components\Layout\Profile;
use MoonShine\Components\Layout\Sidebar;
use MoonShine\Contracts\MoonShineLayoutContract;
final class MoonShineLayout implements MoonShineLayoutContract
{
    public static function build(): LayoutBuilder
    {
        return LayoutBuilder::make([
            Sidebar::make([
                Menu::make()->customAttributes(['class' => 'mt-2']),
                Profile::make(withBorder: true)
            ]),
            //...
        ]);
    }
}
namespace App\MoonShine;
 
use MoonShine\Components\Layout\LayoutBlock;
use MoonShine\Components\Layout\LayoutBuilder;
use MoonShine\Components\Layout\Menu;
use MoonShine\Components\Layout\Profile;
use MoonShine\Components\Layout\Sidebar;
use MoonShine\Contracts\MoonShineLayoutContract;
 
final class MoonShineLayout implements MoonShineLayoutContract
{
    public static function build(): LayoutBuilder
    {
        return LayoutBuilder::make([
            Sidebar::make([
                Menu::make()->customAttributes(['class' => 'mt-2']),
                Profile::make(withBorder: true)
            ]),
 
            //...
        ]);
    }
}
namespace App\MoonShine;
use MoonShine\Components\Layout\LayoutBlock;
use MoonShine\Components\Layout\LayoutBuilder;
use MoonShine\Components\Layout\Menu;
use MoonShine\Components\Layout\Profile;
use MoonShine\Components\Layout\Sidebar;
use MoonShine\Contracts\MoonShineLayoutContract;
final class MoonShineLayout implements MoonShineLayoutContract
{
    public static function build(): LayoutBuilder
    {
        return LayoutBuilder::make([
            Sidebar::make([
                Menu::make()->customAttributes(['class' => 'mt-2']),
                Profile::make(withBorder: true)
            ]),
            //...
        ]);
    }
}
 
 

The defaultAvatar() method allows you to override the default profile avatar.
    defaultAvatar(string $url)
    
    defaultAvatar(string $url)
defaultAvatar(string $url)
defaultAvatar(string $url)
defaultAvatar(string $url)
 
- url- default avatar url.
    use MoonShine\Components\Layout\Profile;
Profile::make()
    ->defaultAvatar("https://ui-avatars.com/api/?name=$name")
    
    use MoonShine\Components\Layout\Profile;
 
//...
 
Profile::make()
    ->defaultAvatar("https://ui-avatars.com/api/?name=$name")
use MoonShine\Components\Layout\Profile;
//...
Profile::make()
    ->defaultAvatar("https://ui-avatars.com/api/?name=$name")
use MoonShine\Components\Layout\Profile;
 
//...
 
Profile::make()
    ->defaultAvatar("https://ui-avatars.com/api/?name=$name")
use MoonShine\Components\Layout\Profile;
//...
Profile::make()
    ->defaultAvatar("https://ui-avatars.com/api/?name=$name")