protected $_cast = 'datetime';
protected $pickerOptions = ['format' => 'DD/MM/YYYY HH:mm', 'language' => 'fr'];
protected $_databaseType = 'datetime';
+ protected $_columnType = 'datetime';
+ protected $_columnFormat = 'Y-m-d, H:i';
public function _mutator($value)
{
use CubistMagicAttribute;
protected $_attributes;
protected $_rules = [];
- protected $_columnType = 'text';
+ protected $_columnType = 'text';
protected $_columnMoveAfter = false;
+ protected $_columnFormat = null;
protected $_adminType = 'text';
protected $_viewNamespace = 'crud::fields';
return ['type' => $this->_adminType, 'view_namespace' => $this->_viewNamespace, 'column' => false, 'form' => 'both', 'rules' => '',
'fillable' => true, 'guarded' => false, 'hidden' => false,
'translatable' => $this->_translatable, 'migrateTranslatable' => $this->_migrateTranslatable,
- 'column_type' => $this->_columnType, 'column_move_after' => $this->_columnMoveAfter,
+ 'column_type' => $this->_columnType, 'column_move_after' => $this->_columnMoveAfter, 'column_format' => $this->_columnFormat,
'default' => '', 'cast' => $this->_cast, 'column_view_namespace' => $this->_columnViewNamespace, 'searchLogic' => $this->_searchLogic,
'allow_null' => true,
'can' => $this->_can, 'auth' => $this->_auth,
'type' => $this->getAttribute('column_type'),
'label' => $this->getAttribute('column_label', $this->getAttribute('label')),
'searchLogic' => $this->getAttribute('searchLogic'),
+ 'format' => $this->getAttribute('column_format', null)
];
return $res;
public function defineDbColumn($table)
{
$name = $this->getAttribute('name');
+ if ($name === 'created_at' || $name === 'updated_at') {
+ return;
+ }
$table->addColumn($name,
CubistMagicAbstractModel::toDoctrineType($this->getDatabaseType()),
array_merge(