diff --git a/src/generators/crud/Generator.php b/src/generators/crud/Generator.php index a4f67b221..d717c6790 100644 --- a/src/generators/crud/Generator.php +++ b/src/generators/crud/Generator.php @@ -267,6 +267,18 @@ public function generateActiveField($attribute) return "\$form->field(\$model, '$attribute')->checkbox()"; } + if ($column->type === Schema::TYPE_DATE) { + return "\$form->field(\$model, '$attribute')->textInput(['type' => 'date'])"; + } + + if ($column->type === Schema::TYPE_DATETIME) { + return "\$form->field(\$model, '$attribute')->textInput(['type' => 'datetime-local'])"; + } + + if ($column->type === Schema::TYPE_TIME) { + return "\$form->field(\$model, '$attribute')->textInput(['type' => 'time'])"; + } + if ($column->type === 'text') { return "\$form->field(\$model, '$attribute')->textarea(['rows' => 6])"; } @@ -310,6 +322,18 @@ public function generateActiveSearchField($attribute) return "\$form->field(\$model, '$attribute')->checkbox()"; } + if ($column->type === Schema::TYPE_DATE) { + return "\$form->field(\$model, '$attribute')->textInput(['type' => 'date'])"; + } + + if ($column->type === Schema::TYPE_DATETIME) { + return "\$form->field(\$model, '$attribute')->textInput(['type' => 'datetime-local'])"; + } + + if ($column->type === Schema::TYPE_TIME) { + return "\$form->field(\$model, '$attribute')->textInput(['type' => 'time'])"; + } + return "\$form->field(\$model, '$attribute')"; }