]> _ Git - cubist_cms-back.git/commitdiff
wip #2812 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 31 May 2019 16:05:53 +0000 (18:05 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 31 May 2019 16:05:53 +0000 (18:05 +0200)
src/app/Magic/Controllers/CubistMagicControllerTrait.php
src/app/Magic/Models/CubistMagicAbstractModel.php
src/resources/cubistmagic/Controller.stub

index b5b8fdf9648538803f4c0947321ef5e85ab8d7c6..636975d71b4d19b1065df80a5637049e833bd712 100644 (file)
@@ -18,6 +18,10 @@ trait CubistMagicControllerTrait
             $this->_plural = $this->_singular . 's';
         }
 
+        if ($this->_clonable) {
+            $this->crud->allowAccess('clone');
+        }
+
         /*
         |--------------------------------------------------------------------------
         | CrudPanel Basic Information
index ad7c1dffb8ac2f8f513d019ea714dc12f54e71aa..b2f6c359475de053ca29b413a69e67081b14fc73 100644 (file)
@@ -28,6 +28,7 @@ class CubistMagicAbstractModel extends Model
 
     protected $primaryKey = 'id';
     public $timestamps = true;
+    public $clonable = true;
 
     /**
      * @var Field[]
@@ -188,6 +189,7 @@ class CubistMagicAbstractModel extends Model
             'PLURAL' => $this->getOption('plural', ''),
             'MODELNAMESPACE' => get_class($this),
             'EXTENDS' => $this->_getBaseController(),
+            'CLONABLE' => $this->clonable ? 'true' : 'false'
         ];
 
         $res = file_get_contents($stub);
index b3d5c91fa2c199b8ae1dcfe00873d4ce33f5ccf9..ca89dd3ca802fc8ac828ce25f94543eabadf0e60 100644 (file)
@@ -10,4 +10,5 @@ class _CONTROLLERCLASS_ extends _EXTENDS_
     protected $_routeURL = '_ROUTEURL_';
     protected $_singular = '_SINGULAR_';
     protected $_plural = '_PLURAL_';
+    protected $_clonable = _CLONABLE_;
 }