From 2b84b1b65869b5fc540fdc8e5a2b8ccad2df4747 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 25 Jul 2023 12:48:19 +0200 Subject: [PATCH] wip #6173 @0.5 --- src/app/Console/Commands/GenerateCommand.php | 3 +++ src/app/Console/Commands/MigrateCommand.php | 12 +++++------ src/app/Magic/Fields/Noteditable.php | 10 ++++++++++ .../views/fields/noteditable.blade.php | 20 +++++++++++++++++++ 4 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 src/app/Magic/Fields/Noteditable.php create mode 100644 src/resources/views/fields/noteditable.blade.php diff --git a/src/app/Console/Commands/GenerateCommand.php b/src/app/Console/Commands/GenerateCommand.php index f6f4f85..e98cf0f 100644 --- a/src/app/Console/Commands/GenerateCommand.php +++ b/src/app/Console/Commands/GenerateCommand.php @@ -55,6 +55,9 @@ class GenerateCommand extends CubistCommand */ public function _generate($model) { + if (! $model->getOption('name')) { + return; + } $this->line('Generate code of ' . get_class($model)); $model->generateCode(); diff --git a/src/app/Console/Commands/MigrateCommand.php b/src/app/Console/Commands/MigrateCommand.php index 669f7b4..04c7f83 100644 --- a/src/app/Console/Commands/MigrateCommand.php +++ b/src/app/Console/Commands/MigrateCommand.php @@ -9,8 +9,7 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\Comparator; use Doctrine\DBAL\Schema\Schema; -class MigrateCommand extends CubistCommand -{ +class MigrateCommand extends CubistCommand { /** * The name and signature of the console command. * @@ -32,8 +31,7 @@ class MigrateCommand extends CubistCommand * * @return mixed */ - public function handle() - { + public function handle() { $this->_schema = new Schema(); $this->_handleMagicFolder([$this, '_migrate']); @@ -66,8 +64,10 @@ class MigrateCommand extends CubistCommand /** * @param $model CubistMagicAbstractModel */ - public function _migrate($model) - { + public function _migrate($model) { + if (!$model->getTable()) { + return; + } $this->line('Handling ' . get_class($model)); $res = $model->setSchema($this->_schema); if (null !== $res) { diff --git a/src/app/Magic/Fields/Noteditable.php b/src/app/Magic/Fields/Noteditable.php new file mode 100644 index 0000000..ed2b540 --- /dev/null +++ b/src/app/Magic/Fields/Noteditable.php @@ -0,0 +1,10 @@ + +
+ + @include('crud::inc.field_translatable_icon') + + + {{$v}} + {{-- HINT --}} + @if (isset($field['hint'])) +

{!! $field['hint'] !!}

+ @endif +
-- 2.39.5