From: vince Date: Sat, 6 Nov 2021 16:11:16 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=375395b398e71af51cb39eb28032ee45cc5a6572;p=cubist_cms-back.git . --- diff --git a/src/app/Console/Commands/InstallCommand.php b/src/app/Console/Commands/InstallCommand.php index b40a7cf..faeb3a9 100644 --- a/src/app/Console/Commands/InstallCommand.php +++ b/src/app/Console/Commands/InstallCommand.php @@ -19,7 +19,7 @@ class InstallCommand extends CubistCommand $commands = [ 'Update Cubist' => ['php artisan cubist:update'], - 'Install backpack' => ['php artisan backpack:install --elfinder=no'], + 'Install backpack' => ['php artisan backpack:install'], 'Publish backpack assets' => ['php artisan vendor:publish --provider="Backpack\CRUD\BackpackServiceProvider" --tag="minimum"'], 'Install backpack addons' => [ // BackupManager diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index 1447d74..ea187f6 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -294,10 +294,6 @@ class Field implements \ArrayAccess return; } $name = $this->getAttribute('name'); - if ($name === 'created_at' || $name === 'updated_at') { - return; - } - $attributes = array_merge( ['notnull' => !$this->getAttribute('allow_null', true)], diff --git a/src/app/Magic/Models/CubistMagicAbstractModel.php b/src/app/Magic/Models/CubistMagicAbstractModel.php index 9be0538..924a271 100644 --- a/src/app/Magic/Models/CubistMagicAbstractModel.php +++ b/src/app/Magic/Models/CubistMagicAbstractModel.php @@ -61,6 +61,8 @@ class CubistMagicAbstractModel extends Model implements HasMedia protected $_enableRevisionsButton = false; protected $_enableBulk = true; + public $timestamps = true; + protected $_enableTrackNonDefaultValues = false; protected static $_ownerAttribute = null; @@ -219,15 +221,16 @@ class CubistMagicAbstractModel extends Model implements HasMedia ); if ($this->timestamps) { - $timestamps = [self::UPDATED_AT, self::CREATED_AT, 'deleted_at']; - foreach ($timestamps as $timestamp) { - if ($this->hasField($timestamp)) { + $timestamps = ['updated_at', 'created_at', 'deleted_at']; + foreach ($timestamps as $t) { + if ($this->hasField($t)) { continue; } - $this->addField($timestamp, Datetime::class, '', ['hidden' => true]); + $this->addField($t, Datetime::class, '', ['hidden' => true]); } } + $this->fakeColumns = array_unique($this->fakeColumns); if (get_class($this) !== config("auth.providers.users.model")) { foreach ($this->_fields as $name => $field) { @@ -527,19 +530,6 @@ class CubistMagicAbstractModel extends Model implements HasMedia $this->_createOneInstance(); } - - /** - * @param $table Table - */ - protected function _addTimestampsDatabaseColumns($table) - { - - $options = ['notnull' => false]; - $table->addColumn(static::CREATED_AT, 'datetime', $options); - $table->addColumn(static::UPDATED_AT, 'datetime', $options); - $table->addColumn('deleted_at', 'datetime', $options); - } - /** * @param $class Model|string * @return Model