/** * Finds the StockOperateLog model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return StockOperateLog the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = StockOperateLog::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use backend\models\StockOperateLog; /* @var $this yii\web\View */ /* @var $model backend\models\StockOperateLog */ /* @var $form yii\widgets\ActiveForm */ ?> <?php $form = ActiveForm::begin(); ?> <div class="box-body stock-operate-log-form"> <?php echo $form->field($model, 'operate_type')->textInput()->dropDownList(StockOperateLog::getOperateType()); ?> <?php echo $form->field($model, 'stock_code')->textInput(['maxlength' => true, 'placeholder' => '输入' . $model->getAttributeLabel('stock_code')]); ?> <?php echo $form->field($model, 'num')->textInput(['placeholder' => '输入' . $model->getAttributeLabel('num')]); ?> <?php echo $form->field($model, 'unit_price')->textInput(['placeholder' => '输入' . $model->getAttributeLabel('unit_price')]); ?> </div> <div class="box-footer">