Foro oficial de PHP

Ok Gracias por responder.

El inconveniente es que no muestra ningún error, solo no funciona como debiera ser.
362994

Y tampoco inserta lo que se escribe en este campo.

La vista _form.php
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use marqu3s\summernote\Summernote;
// use marqu3s\summernote\SummernoteAsset;
// use marqu3s\summernote\SummernoteLanguageAsset;

/* @var $this yii\web\View */
/* @var $model app\models\Noticias */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="contenido-admin">

<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, 'titulo')->textInput(['maxlength' => true]) ?>

<?= Summernote::widget([
'name' => 'noticia',
'clientOptions' => [
'id' => 'noticia-summernote',
'toolbar' => [
['lang:', 'es-ES'],
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'picture', 'hr']],
// ['view', ['fullscreen', 'codeview']],
// ['help', ['help']],
],
]
]) ?>

<div class="form-group">
<?= Html::submitButton('Guardar', ['class' => 'btn btn-success']) ?>
</div>

<?php ActiveForm::end(); ?>

</div>
<script>
$(document).ready(function() {
$('#summernote').summernote(
{
lang: 'es-ES'
}
);
});
</script>

Controlador actionCreate()

public function actionCreate()
{
$model = new Noticias();

if ($model->load(Yii::$app->request->post())) {

if ( $model->save() ) {
$this->msgFlashSuccessCreate($model);
} else {
$this->msgFlashErrorCreate($model);
}
return $this->redirect(['index']);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}

El Modelo
<?php

namespace app\models;

use Yii;
use yii\db\ActiveRecord;

/**
* This is the model class for table "noticias".
*
* @property int $id
* @property string $titulo
* @property string $noticia
* @property string $created_at
* @property string $updated_at
* @property int $created_by
* @property int $updated_by
*/
class Noticias extends MyActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'noticias';
}

/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['titulo'], 'required'],
[['noticia'], 'string'],
[['created_at', 'updated_at','noticia'], 'safe'],
[['created_by', 'updated_by'], 'integer'],
[['titulo'], 'string', 'max' => 50],
];
}

/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'titulo' => 'Titulo',
'noticia' => 'Noticia',
'created_at' => 'fecha',
'updated_at' => 'Updated At',
'created_by' => 'Created By',
'updated_by' => 'Updated By',
];
}
}

Estructura de la tabla noticias
362995


Muchas Gracias por la ayuda
Un Cordial Saludo desde Valparaíso - Chile
 

Los últimos temas