@extends('admin.layouts.layout') @section('main')
@include('admin.layouts.breadcrumb')
@include('admin.flash-message')
@foreach($errors->all() as $error)
Error!{{ $error }}
@endforeach
{{ $module }}
@if($id) {!! Form::model($data, [ 'method' => 'PATCH', 'route' => [$form['route'], $id], 'class' => 'form-horizontal', 'enctype'=>'multipart/form-data' ]) !!} @else {!! Form::open(array('route' => $form['route'],'method'=>'POST', 'enctype'=>'multipart/form-data')) !!} @endif @if(!empty($form['fields'])) @php ($editorScript = 0) @foreach($form['fields'] as $key => $value) @if(!in_array($value['type'], ['html', 'include'])) @php ($attributes = (isset($value['attributes']) ? $value['attributes'] : [])) @php ($attributes['id'] = (isset($attributes['id']) ? $attributes['id'] : $key)) @php ($attributes['class'] = (isset($attributes['class']) ? $attributes['class'] : 'form-control')) @php ($inputValue = (isset($value['value']) ? $value['value'] : null))
@if(isset($value['label'])) @endif
@if($value['type'] == 'text') {!! Form::text($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'label') {!! "

". $value['value'] . "

" !!} @elseif($value['type'] == 'hidden') {!! Form::hidden($key, $inputValue) !!} @elseif($value['type'] == 'email') {!! Form::email($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'password') {!! Form::password($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'textarea') {!! Form::textarea($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'editor') @php ($attributes['class'] .= ' ckeditor') {!! Form::textarea($key, $inputValue, $attributes) !!} @if($editorScript == 0) @push('page_script') @endpush @php ($editorScript = 1) @endif @elseif($value['type'] == 'select') @php ($attributes['class'] .= ' form-control') {!! Form::select($key, $value['options'], $value['value'], $attributes) !!} @elseif($value['type'] == 'radio') @foreach($value['options'] as $k => $option)
{!! Form::radio($key, $k, ($k == $value['value'] ? true : false), array('class' => 'form-check-input', 'id' => $key . '-' . $k)); !!}
@endforeach @elseif($value['type'] == 'checkbox') {!! Form::checkbox($key, $value['options'], $value['value'], $attributes) !!} @elseif($value['type'] == 'file') {!! Form::file($key) !!} @if($value['value']) @endif @endif @if(isset($value['help'])) {{ $value['help'] }} @endif
@elseif($value['type'] == 'html')
{!! $value['value'] !!}
@elseif($value['type'] == 'include') @include($value['value']) @endif @endforeach @endif @if(isset($include_page)) @include($include_page) @endif
{!! Form::close() !!}
@endsection @push('scripts') @endpush