@extends('layouts.app') @section('content')

Edit Admin

@csrf @method('PUT')
@php use Spatie\Permission\Models\Role; $creator = auth()->user(); $assignableRoles = collect(); if ($creator->hasRole('super admin')) { $assignableRoles = Role::all(); } elseif ($creator->hasRole('admin')) { $assignableRoles = Role::whereIn('name', ['admin', 'user'])->get(); } $roleLabels = [ 'super admin' => 'Super Admin', 'admin' => 'Editor', 'user' => 'Viewer', ]; $currentRole = $user->getRoleNames()->first(); @endphp
{{-- Role Selector --}}
@foreach($assignableRoles as $role) @php $inputId = 'role_' . $role->id; @endphp @endforeach
{{-- Permissions: Shown only if "admin" (Editor) is selected --}}
@if($creator->can_sell) @endif @if($creator->can_lease) @endif @if($creator->can_rent) @endif
@endsection