public function setupSaveActions($type)
{
-
$instance = $this->getModelInstance();
if ($instance instanceof CubistMagicAbstractModel) {
if ($this->_oneInstance) {
$this->crud->removeSaveAction('save_and_new');
$this->crud->removeSaveAction('save_and_edit');
$this->crud->addSaveAction([
- 'name' => 'save_and_edit',
+ 'name' => 'save_and_back',
'visible' => function ($crud) {
return $crud->hasAccess('update');
},
if ($request->has('current_tab')) {
$redirectUrl = $redirectUrl . '#' . $request->get('current_tab');
}
-
return $redirectUrl;
},
'referrer_url' => function ($crud, $request, $itemId) {
@php
$o=$field['value'] ?? old(square_brackets_to_dots($field['name']))??$field['default'];
+ if(!is_array($field['options'])){
+ $field['options']=[];
+ }
$is_null=null===$o || $o==='null';
if(!function_exists('select2_from_array_selected')){
}
@endphp
- <!-- select2 from array -->
+ <!-- select2 from array -->
@include('crud::fields.inc.wrapper_start')
<label>{!! $field['label'] !!}</label>
@if (isset($field['allows_multiple']) && $field['allows_multiple']==true)
<input type="hidden" name="{{ $field['name'] }}" value=""/>
@endif
<select
- name="{{ $field['name'] }}@if (isset($field['allows_multiple']) && $field['allows_multiple']==true)[]@endif"
- style="width: 100%"
- @include('crud::fields.inc.attributes', ['default_class' => 'form-control select2_from_array'])
- @if (isset($field['allows_multiple']) && $field['allows_multiple']==true)multiple @endif
- @if($ajax) data-ajax="{{$field['ajax']}}" @endif
- @if($allows_html) data-allow-html="1" @endif
- data-options="{{ json_encode($field['options']) }}"
- @if(isset($field['free']) && $field['free']) data-free="1" @endif
- data-value="{{is_scalar($o)?$o:json_encode($o)}}"
+ name="{{ $field['name'] }}@if (isset($field['allows_multiple']) && $field['allows_multiple']==true)[]@endif"
+ style="width: 100%"
+ @include('crud::fields.inc.attributes', ['default_class' => 'form-control select2_from_array'])
+ @if (isset($field['allows_multiple']) && $field['allows_multiple']==true)multiple @endif
+ @if($ajax) data-ajax="{{$field['ajax']}}" @endif
+ @if($allows_html) data-allow-html="1" @endif
+ data-options="{{ json_encode($field['options']) }}"
+ @if(isset($field['free']) && $field['free']) data-free="1" @endif
+ data-value="{{is_scalar($o)?$o:json_encode($o)}}"
>
@if (isset($field['allows_null']) && $field['allows_null']==true)
@if($is_null)
<link href="{{ asset('packages/select2/dist/css/select2.min.css') }}" rel="stylesheet"
type="text/css"/>
<link
- href="{{ asset('packages/select2-bootstrap-theme/dist/select2-bootstrap.min.css') }}"
- rel="stylesheet" type="text/css"/>
+ href="{{ asset('packages/select2-bootstrap-theme/dist/select2-bootstrap.min.css') }}"
+ rel="stylesheet" type="text/css"/>
@endpush
{{-- FIELD JS - will be loaded in the after_scripts section --}}