@extends('layouts.app') @section('content-header')
@if(!$role->id) {{ Breadcrumbs::render('roles-form', 'Create new', '') }}

Create Role

@else {{ Breadcrumbs::render('roles-form', $role->name, $role->id) }}

Edit Role

@endif
@endsection @section('content') @if(!$role->id) {!! Form::model($role, [ 'method' => 'POST', 'route' => ['admin.roles.store'], 'role' => 'form'])!!} @else {!! Form::model($role, [ 'method' => 'PUT', 'route' => ['admin.roles.update', $role->id], 'role' => 'form'])!!} @endif
@if (count($errors) > 0)
Whoops! There were some problems with your input.

    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @if ($message = Session::get('fail'))
Whoops! There were some problems with your input.

{{ $message }}
@endif
{!! Form::label('lblName', 'Name', ['class' => 'control-label']) !!} {!! Form::text('txtName', $role->name, ['class' => 'form-control', 'placeholder' => 'Role Name', 'required' => '']) !!} @if($errors->has('txtName'))

{{$errors->first('txtName')}}

@endif
@php $i = 0; $group = ''; @endphp @foreach ($permissions as $permission) @php $label_id = 'lblRole' . $i; @endphp @if ($group != $permission->group) @php $group = $permission->group; @endphp @if ($i != 0)
@endif
{{$permission_group[$permission->group]}}
@endif @if (isset($role_permissions[$permission->name])) {!! Form::checkbox('txtPermission[]', $permission->name, true, ['class' => '', 'id' => $label_id]) !!} @else {!! Form::checkbox('txtPermission[]', $permission->name, false, ['class' => '', 'id' => $label_id]) !!} @endif {!! Form::label($label_id, ucwords($permission->name)); !!}
@php $i++; @endphp @endforeach
{!! Form::submit('Submit', ['class' => 'btn btn-primary'])!!} {!! link_to_route('admin.roles.index', 'Cancel', null, ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!} @endsection @include('_components.scripts.form')