_fields.blade.php 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. <div class="row">
  2. <div class="col-12">
  3. <label for="roles_form_group">{!! __('rbac::roles.roles') !!}</label>
  4. <div class="form-group" id="roles_form_group">
  5. @foreach($allRoles as $key => $role)
  6. <div class="form-check">
  7. <input class="form-check-input @if($errors->has('roles')) is-invalid @endif" type="checkbox" name="roles[]" value="{{ $role->id }}" id="role_checkbox_{{$key}}"
  8. @cannot(Itstructure\LaRbac\Models\Permission::ASSIGN_ROLE_FLAG, Itstructure\LaRbac\Classes\MemberToRole::make($user, $role)) disabled @endcannot
  9. @if(isset($currentRoles) && in_array($role->id, $currentRoles)) checked @endif >
  10. <label class="form-check-label" for="role_checkbox_{{$key}}">
  11. {{ $role->name }}
  12. </label>
  13. </div>
  14. @if(isset($currentRoles) && in_array($role->id, $currentRoles))
  15. @cannot(Itstructure\LaRbac\Models\Permission::ASSIGN_ROLE_FLAG, Itstructure\LaRbac\Classes\MemberToRole::make($user, $role))
  16. <input type="hidden" name="roles[]" value="{{ $role->id }}">
  17. @endcannot
  18. @endif
  19. @endforeach
  20. </div>
  21. </div>
  22. </div>
  23. @if ($errors->has('roles'))
  24. <div class="row">
  25. <div class="col-12 col-md-8 col-lg-6 col-xl-4 text-center">
  26. <div class="alert alert-danger px-3 py-2" role="alert">
  27. <strong>{{ $errors->first('roles') }}</strong>
  28. </div>
  29. </div>
  30. </div>
  31. @endif