Skip to content

Portal Users

Phillip Dornauer edited this page Apr 1, 2026 · 1 revision

Portal Users

Portal users are frontend visitors who can log in to access restricted content. They are completely separate from admin users.

Managing Portal Users

Go to System → Portal Users in the admin.

Properties

Property Description
Email Login email
Password Hashed login password
Enabled Disabled accounts cannot log in
Item Optionally link the user to a content item (e.g. a team member profile)

Frontend Auth Routes

Route Description
GET /portal/login Login form
POST /portal/login Submit credentials
GET /portal/register Registration form
POST /portal/register Submit registration
POST /portal/logout Sign out

Protecting Routes

Route::get('/members', MembersController::class)
    ->middleware('marble.portal.auth');

Unauthenticated visitors are redirected to /portal/login.

Checking Auth in Blade

@if(Marble::isPortalAuthenticated())
    <p>Welcome, {{ Marble::portalUser()?->email }}</p>
    <form action="{{ route('marble.portal.logout') }}" method="POST">
        @csrf <button type="submit">Sign out</button>
    </form>
@else
    <a href="{{ route('marble.portal.login') }}">Sign in</a>
@endif

Linking to Content Items

A portal user can be linked to a content item for personalized content:

@php $profile = Marble::portalUser()?->item; @endphp
@if($profile)
    <h2>{{ $profile->name() }}</h2>
    <p>{{ $profile->value('bio') }}</p>
@endif

Example: Gated Intranet Section

@if(!Marble::isPortalAuthenticated())
    <p>This section is for employees only.</p>
    <a href="{{ route('marble.portal.login') }}">Sign in</a>
@else
    <h1>{{ $item->name() }}</h1>
    {!! $item->value('content') !!}
@endif

Clone this wiki locally