<form id="form-staff-permission"> <table class="table table-bordered table-striped"> <input type="hidden" name="id" value="<?php echo e($user->id); ?>"/> <tbody> <?php $__currentLoopData = config('permissions'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <tr> <td> <?php echo e($item['name']); ?></td> <td> <div class="mt-checkbox-inline"> <label class="mt-checkbox"> <input type="checkbox" class="check-all"> Tất cả <span></span> </label> <?php $__currentLoopData = $item['permissions']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $perm): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <label class="mt-checkbox"> <input type="checkbox" name="permissions[]" value="<?php echo e($perm['name']); ?>" <?php if($user->hasPermissionTo($perm['name'])): ?> checked <?php endif; ?>> <?php echo e($perm['display_name']); ?> <span></span> </label> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </div> </td> </tr> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <tr> <td> Phân quyền theo nhà trọ</td> <td> <?php $hostels = \App\Models\Hostel::where('owner_id', auth('backend')->user()->id)->get();
                    $hostelArrs = $user->staffHostelArr->pluck('hostel_id')->toArray();
                ?> <div class="mt-checkbox-inline"> <?php $__currentLoopData = $hostels; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $hostel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <label class="mt-checkbox"> <input type="checkbox" class="check-hostel" name="hostels[]" value="<?php echo e($hostel->id); ?>" <?php if(!empty($hostelArrs)): ?> <?php if(in_array($hostel->id, $hostelArrs)): ?>checked <?php endif; ?> <?php endif; ?> > <?php echo e($hostel->name); ?> <span></span> </label> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <label class="mt-checkbox"> <input type="checkbox" class="check-hostel check-all" id="all" name="hostels[]" value="-1" <?php if(!empty($hostelArrs)): ?> <?php if(in_array($hostel->id, $hostelArrs)): ?>checked <?php endif; ?> <?php endif; ?>> Tất cả <span></span> </label> </div> </td> </tr> </tbody> </table> </form>