如何解决modals laravel背包内的modals
我对 Laravel 背包中的内联创建操作有疑问:是否可以在内联创建操作中创建模态? 我想要的是,当我使用内联创建操作创建相关项目时,我会在这些项目中创建其他相关项目(类似于内联创建操作中的“内联创建”)。 也许我需要在 inline_create_modal 中添加一些代码?
if($activeInlineCreate) {
//we check if this field is not beeing requested in some InlineCreate operation.
//this variable is setup by InlineCreate modal when loading the fields.
if(!isset($inlineCreate)) {
//by default,when creating an entity we want it to be selected/added to selection.
$field['inline_create']['force_select'] = $field['inline_create']['force_select'] ?? true;
$field['inline_create']['modal_class'] = $field['inline_create']['modal_class'] ?? 'modal-dialog';
//if user don't specify a different entity in inline_create we assume it's the same from $field['entity'] kebabed
$field['inline_create']['entity'] = $field['inline_create']['entity'] ?? $routeEntity;
//route to create a new entity
$field['inline_create']['create_route'] = route($field['inline_create']['entity']."-inline-create-save");
//route to modal
$field['inline_create']['modal_route'] = route($field['inline_create']['entity']."-inline-create");
//include main form fields in the request when asking for modal data,//allow the developer to modify the inline create modal
//based on some field on the main form
$field['inline_create']['include_main_form_fields'] = $field['inline_create']['include_main_form_fields'] ?? false;
if(!is_bool($field['inline_create']['include_main_form_fields'])) {
if(is_array($field['inline_create']['include_main_form_fields'])) {
$field['inline_create']['include_main_form_fields'] = json_encode($field['inline_create']['include_main_form_fields']);
}else{
//it is a string or treat it like
$arrayed_field = array($field['inline_create']['include_main_form_fields']);
$field['inline_create']['include_main_form_fields'] = json_encode($arrayed_field);
}
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。