2024-06-20 16:42:33 +05:45

70 lines
3.1 KiB
PHP

@extends('backend.template')
@section('content')
<div class="row">
<div class="card col-8">
<div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ __('Edit Roles') }}</h2>
<a href="{{ route('roles.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
</div>
<div class="card-body">
<form action="{{ route('roles.update', [$data->id]) }}" id="updateCustomForm" method="POST">
@csrf
@method('PUT')
<input type="hidden" name="id" value="{{ $data->id }}" />
<div class="row">
<div class="col-lg-6">
<label for="name" class="form-label">Name</label>
<input type="text" id="name" name="name" class="form-control"
value="{{ $data->name }}">
</div>
<div class="col-lg-6">
<label for="guard_name" class="form-label">Guard Name</label>
<input type="text" id="guard_name" name="guard_name" class="form-control"
value="{{ $data->guard_name }}">
</div>
<div class="col-lg-6 pb-3">
<label for="permission" class="form-label">Permission</label>
<select id="permission" name="permission" class="form-select">
<option value="0">Add Permissions</option>
@foreach ($permissions as $permission)
<option value="{{ $permission->name }}">{{ $permission->name }}</option>
@endforeach
</select>
</div>
<div class="col-md-12">
<button type="submit" class="btn btn-primary btn-update">Submit</button>
<a href="{{ route('roles.index') }}" class="btn btn-primary btn-cancel">Cancel</a>
</div>
</div>
</form>
</div>
</div>
<div class="card col-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h4>{{ __('Roles with permissions') }}</h4>
</div>
<div class="card-body">
@if ($data->permissions)
@foreach ($data->permissions as $role_permission)
<form class="d-inline-block" method="POST" action="{{route('roles.permissions.revoke',[$data->id,$role_permission->id])}}"
onsubmit="return confirm('Are you sure?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">{{ $role_permission->name }}</button>
</form>
@endforeach
@endif
</div>
</div>
</div>
@endsection