OMNI Access v1.3.0 Free ~8 min read

Blade Directives

Conditionally render Blade views with @role, @hasrole, @canrole, @permission, and related directives provided by OMNI Access.

A Administrator Oct 18, 2026 3 Steps 2,617 views
Discussion (0)
Step 1 of 3

Role Directives

{{-- Check single role --}}
@role('admin')
    <button>Admin Panel</button>
@endrole

{{-- Alternative syntax --}}
@hasrole('admin')
    <p>Welcome Admin!</p>
@endhasrole

{{-- Check any role --}}
@hasanyrole('admin|editor')
    <a href="/dashboard">Dashboard</a>
@endhasanyrole

{{-- Check all roles --}}
@hasallroles('admin|moderator')
    <button>Super Controls</button>
@endhasallroles

{{-- Else condition --}}
@role('admin')
    <p>Admin content</p>
@else
    <p>Regular user content</p>
@endrole
blade
{{-- Check single role --}}
@role('admin')
    <button>Admin Panel</button>
@endrole

{{-- Alternative syntax --}}
@hasrole('admin')
    <p>Welcome Admin!</p>
@endhasrole

{{-- Check any role --}}
@hasanyrole('admin|editor')
    <a href="/dashboard">Dashboard</a>
@endhasanyrole

{{-- Check all roles --}}
@hasallroles('admin|moderator')
    <button>Super Controls</button>
@endhasallroles

{{-- Else condition --}}
@role('admin')
    <p>Admin content</p>
@else
    <p>Regular user content</p>
@endrole
Step 2 of 3

Permission Directives

{{-- Check single permission --}}
@permission('posts.edit')
    <button>Edit Post</button>
@endpermission

{{-- Alternative syntax --}}
@haspermission('posts.delete')
    <button class="btn-danger">Delete</button>
@endhaspermission

{{-- Check any permission --}}
@hasanypermission('posts.edit|posts.create')
    <div class="post-actions">
        {{-- Show actions --}}
    </div>
@endhasanypermission

{{-- Check all permissions --}}
@hasallpermissions('posts.edit|posts.publish')
    <button>Edit & Publish</button>
@endhasallpermissions
blade
{{-- Check single permission --}}
@permission('posts.edit')
    <button>Edit Post</button>
@endpermission

{{-- Alternative syntax --}}
@haspermission('posts.delete')
    <button class="btn-danger">Delete</button>
@endhaspermission

{{-- Check any permission --}}
@hasanypermission('posts.edit|posts.create')
    <div class="post-actions">
        {{-- Show actions --}}
    </div>
@endhasanypermission

{{-- Check all permissions --}}
@hasallpermissions('posts.edit|posts.publish')
    <button>Edit & Publish</button>
@endhasallpermissions
Step 3 of 3

Combined Examples

<nav>
    @role('admin')
        <a href="/admin">Admin Panel</a>
    @endrole

    @hasanyrole('editor|author')
        <a href="/posts/create">New Post</a>
    @endhasanyrole

    @permission('users.view')
        <a href="/users">Users</a>
    @endpermission
</nav>

{{-- Post actions --}}
<div class="post-actions">
    @permission('posts.edit')
        <button class="btn btn-primary">Edit</button>
    @endpermission

    @permission('posts.delete')
        <button class="btn btn-danger">Delete</button>
    @else
        <span class="text-muted">No delete permission</span>
    @endpermission
</div>
blade
<nav>
    @role('admin')
        <a href="/admin">Admin Panel</a>
    @endrole

    @hasanyrole('editor|author')
        <a href="/posts/create">New Post</a>
    @endhasanyrole

    @permission('users.view')
        <a href="/users">Users</a>
    @endpermission
</nav>

{{-- Post actions --}}
<div class="post-actions">
    @permission('posts.edit')
        <button class="btn btn-primary">Edit</button>
    @endpermission

    @permission('posts.delete')
        <button class="btn btn-danger">Delete</button>
    @else
        <span class="text-muted">No delete permission</span>
    @endpermission
</div>
Previous Step

Congratulations! You Completed This Guide

You've walked through all 3 steps for OMNI Access v1.3.0. Keep practicing and exploring more hands-on tutorials.

Community Discussions 0

Ask questions, share step solutions, or discuss software workflows with other professionals.

Moderated Community

Join the Community Discussion

Got stuck on a step or have a question about this configuration? Sign in to join the discussion and receive direct advice from instructors and peers.

No Discussions Yet

Have a question or found a clever tip for this guide? Start the conversation using the comment box above!

Guide Checklist

3 Steps
Tutorial Progress 0%
Promotional Ads Available Space
Place Your advertising ads Here

Promote your brand, product, or service directly to our active readers and community.

Contact Us