Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

joshuapphillips's avatar

How do I control which roles can create other roles in Jetstream

In app-name/resources/views/teams/team-member-manager.blade.php users with specific roles can be added.

I would like it so super_admin can add admin and users. Admin can add users but I don't want admin to be able to add super_admin.

I can see in my blade component it is getting roles but I can't figure out where from.

How do I scope my roles depending on the current users role and which file do I do this in?

@if (count($this->roles) > 0)
    <div class="col-span-6 lg:col-span-4">
        <x-jet-label for="role" value="{{ __('Role') }}" />
        <x-jet-input-error for="role" class="mt-2" />
    
        <div class="relative z-0 mt-1 border border-gray-200 rounded-lg cursor-pointer">
            @foreach ($this->roles as $index => $role)
            <button type="button"
                class="relative px-4 py-3 inline-flex w-full rounded-lg focus:z-10 focus:outline-none focus:border-blue-300 focus:ring focus:ring-blue-200 {{ $index > 0 ? 'border-t border-gray-200 rounded-t-none' : '' }} {{ ! $loop->last ? 'rounded-b-none' : '' }}"
                wire:click="$set('addTeamMemberForm.role', '{{ $role->key }}')">
                <div
                    class="{{ isset($addTeamMemberForm['role']) && $addTeamMemberForm['role'] !== $role->key ? 'opacity-50' : '' }}">
                    <!-- Role Name -->
                    <div class="flex items-center">
                        <div
                            class="text-sm text-gray-600 {{ $addTeamMemberForm['role'] == $role->key ? 'font-semibold' : '' }}">
                            {{ $role->name }}
                        </div>
    
                        @if ($addTeamMemberForm['role'] == $role->key)
                        <svg class="ml-2 h-5 w-5 text-green-400" fill="none" stroke-linecap="round" stroke-linejoin="round"
                            stroke-width="2" stroke="currentColor" viewBox="0 0 24 24">
                            <path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                        </svg>
                        @endif
                    </div>
    
                    <!-- Role Description -->
                    <div class="mt-2 text-xs text-gray-600 text-left">
                        {{ $role->description }}
                    </div>
                </div>
            </button>
            @endforeach
        </div>
    </div>
@endif   
0 likes
0 replies

Please or to participate in this conversation.