crud->addColumns([ [ 'name' => 'post_at', 'label' => trans('backend.columnName.post_at'), 'type' => 'datetime', 'format' => 'YYYY/MM/DD HH:mm:SS', ], [ 'name' => 'is_front_show', 'label' => trans('backend.columnName.is_front_show'), 'type' => 'checkbox' ], [ 'name' => 'title', 'label' => trans('backend.columnName.title'), 'type' => 'text' ] ]); } /** * Define what happens when the Create operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-create * @return void */ protected function setupCreateOperation() { CRUD::setValidation(NewsRequest::class); $this->crud->addFields([ [ 'name' => 'news_catalog_id', 'label' => trans('backend.columnName.catalog'), 'type' => 'select2_nested', 'entity' => 'newsCatalog', 'attribute' => 'name', 'model' => 'App\Models\NewsCatalog', ], [ 'name' => 'post_at', 'label' => trans('backend.columnName.post_at'), 'type' => 'datetime', 'format' => 'YYYY/MM/DD HH:mm:SS', ], [ 'name' => 'is_front_show', 'label' => trans('backend.columnName.is_front_show'), 'type' => 'boolean' ], [ 'name' => 'title', 'label' => trans('backend.columnName.title'), 'type' => 'text' ], [ 'name' => 'photos', 'label' => trans('backend.columnName.cover'), 'type' => 'upload_img_multiple', 'upload' => true, 'disk' => 'public', 'hint' => '', 'qty' => 1, // 0=no limit, >0=limit 'showSingleChoise' => '0', // 0=hidden, 1=show(default) 'showComment' => '0', // 0=hidden, 1=show(default) ], [ 'name' => 'description', 'label' => trans('backend.columnName.description'), 'type' => 'textarea' ], [ 'name' => 'body', 'lable' => trans('backend.columnName.body'), 'type' => 'tinymce', // optional overwrite of the configuration array 'options' => [ //'selector' => 'textarea.tinymce', //'skin' => 'dick-light', 'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help', 'menubar' => 'edit insert view format help', 'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link', 'language' => str_replace('-', '_', app()->getLocale()), 'height' => '500px', ], ], [ 'name' => 'source_links', 'lable' => 'Source Links', 'type' => 'key_val_multiple', ], [ 'name' => 'seo_keyword', 'label' => trans('backend.columnName.seo_keyword'), 'type' => 'text' ], [ 'name' => 'seo_description', 'label' => trans('backend.columnName.seo_description'), 'type' => 'textarea' ], ]); } /** * Define what happens when the Update operation is loaded. * * @see https://backpackforlaravel.com/docs/crud-operation-update * @return void */ protected function setupUpdateOperation() { $this->setupCreateOperation(); } }