]> _ Git - cubist_cms-back.git/commitdiff
#2810
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 11 Jun 2019 15:34:26 +0000 (17:34 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 11 Jun 2019 15:34:26 +0000 (17:34 +0200)
src/app/Console/Commands/InstallCommand.php [new file with mode: 0644]
src/app/Magic/Fields/Files.php

diff --git a/src/app/Console/Commands/InstallCommand.php b/src/app/Console/Commands/InstallCommand.php
new file mode 100644 (file)
index 0000000..2b56030
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+
+namespace Cubist\Backpack\app\Console\Commands;
+
+use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel;
+use Cubist\Backpack\app\Magic\Util;
+
+class InstallCommand extends CubistCommand
+{
+    protected $signature = 'cubist:install';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Run all needed installation steps';
+
+    public function handle()
+    {
+        $commands = ["Dropzone" => 'php artisan gaspertrix:backpack:dropzone:install',
+            'Laravel media library' => [
+                'php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="migrations"',
+                'php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="config"'
+            ],
+            'Cubist code generation' => ['php artisan cubist:magic:generate'],
+            'Database migrations' => [
+                'php artisan migrate',
+                'php artisan cubist:magic:migrate'
+            ],
+        ];
+
+        $this->progressBar = $this->output->createProgressBar(count($commands));
+        $this->progressBar->start();
+        $this->info(' Cubist installation, please wait');
+
+        foreach ($commands as $label => $command) {
+            $this->line(' Run ' . $label);
+            if (is_string($command)) {
+                $command = [$command];
+            }
+            foreach ($command as $cmd) {
+                $this->executeProcess($cmd);
+            }
+
+            $this->progressBar->advance();
+        }
+        $this->info(" Cubist successfully installed.");
+    }
+
+
+}
index bcfaf72b01cbb1df0820f553e0ab86bf57fe613a..e98ffd1d655467f3b00cbb837fa0231561eaa3d5 100644 (file)
@@ -3,19 +3,17 @@
 
 namespace Cubist\Backpack\app\Magic\Fields;
 
-
-use Cubist\Backpack\CubistBackpackServiceProvider;
-
 class Files extends Field
 {
     protected $_mimeTypes = null;
     protected $_multiple = false;
-    protected $_adminType = 'dropzone';
-    protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+    protected $_adminType = 'dropzone_media';
     protected $_databaseType = 'text';
+    protected $_collection = 'files';
+    protected $_thumbCollection = 'thumbs';
 
     public function getDefaultAttributes()
     {
-        return array_merge(parent::getDefaultAttributes(), ['mime_types' => $this->_mimeTypes, 'multiple' => $this->_multiple]);
+        return array_merge(parent::getDefaultAttributes(), ['mime_types' => $this->_mimeTypes, 'collection' => $this->_collection, 'thumb_collection' => $this->_thumbCollection]);
     }
 }