]> _ Git - cubist_cms-back.git/commitdiff
wip #6173 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 25 Jul 2023 10:48:19 +0000 (12:48 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 25 Jul 2023 10:48:19 +0000 (12:48 +0200)
src/app/Console/Commands/GenerateCommand.php
src/app/Console/Commands/MigrateCommand.php
src/app/Magic/Fields/Noteditable.php [new file with mode: 0644]
src/resources/views/fields/noteditable.blade.php [new file with mode: 0644]

index f6f4f8516347535bedabea746f4301b73a7fc737..e98cf0f3d0c78a2afb6536a5a981a0b5de28dc88 100644 (file)
@@ -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();
 
index 669f7b4308832727be73da682a48e0351327a0ae..04c7f830eacc27bea20d1e9e27aaada8fcd3d46b 100644 (file)
@@ -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 (file)
index 0000000..ed2b540
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+
+namespace Cubist\Backpack\app\Magic\Fields;
+
+
+class Noteditable extends Field
+{
+    protected $_adminType = 'noteditable';
+}
diff --git a/src/resources/views/fields/noteditable.blade.php b/src/resources/views/fields/noteditable.blade.php
new file mode 100644 (file)
index 0000000..8aaf271
--- /dev/null
@@ -0,0 +1,20 @@
+@php
+    $v=old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '';
+@endphp
+    <!-- text input -->
+<div @include('crud::inc.field_wrapper_attributes') >
+    <label>{!! $field['label'] !!}</label>
+    @include('crud::inc.field_translatable_icon')
+
+    <input
+        hidden="text"
+        name="{{ $field['name'] }}"
+        value="{{$v}}"
+        @include('crud::inc.field_attributes')
+    >
+    <span>{{$v}}</span>
+    {{-- HINT --}}
+    @if (isset($field['hint']))
+        <p class="help-block">{!! $field['hint'] !!}</p>
+    @endif
+</div>