]> _ Git - cubist_cms-back.git/commitdiff
wip #3439 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Feb 2020 17:58:20 +0000 (18:58 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Feb 2020 17:58:20 +0000 (18:58 +0100)
src/app/CubistCrudRouter.php [deleted file]
src/app/Magic/Controllers/CubistMagicController.php
src/app/Magic/Fields/Locale.php
src/app/Magic/Models/CubistMagicAbstractModel.php

diff --git a/src/app/CubistCrudRouter.php b/src/app/CubistCrudRouter.php
deleted file mode 100644 (file)
index 212f462..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-
-namespace Cubist\Backpack;
-
-use Backpack\CRUD\CrudRouter;
-
-use Illuminate\Support\Facades\Route;
-
-class CubistCrudRouter extends CrudRouter
-{
-    public function __construct($name, $controller, $options)
-    {
-        parent::__construct($name, $controller, $options);
-
-        Route::post($this->name . '/bulk-publish', [
-            'as' => 'crud.' . $this->name . '.bulkPublish',
-            'uses' => $this->controller . '@bulkPublish',
-        ]);
-
-        Route::post($this->name . '/bulk-offline', [
-            'as' => 'crud.' . $this->name . '.bulkOffline',
-            'uses' => $this->controller . '@bulkOffline',
-        ]);
-
-        Route::post($this->name . '/bulk-translations-replace', [
-            'as' => 'crud.' . $this->name . '.bulkTranslationsReplace',
-            'uses' => $this->controller . '@bulkTranslationsReplace',
-        ]);
-
-        Route::match(['post'], $this->name . '/{id}/media', $this->controller . '@uploadMedia');
-        Route::match(['delete'], $this->name . '/{id}/media/{mediaId}', $this->controller . '@deleteMedia');
-        Route::match(['post'], $this->name . '/{id}/media/reorder', $this->controller . '@reorderMedia');
-    }
-}
index b22fbf5b1934ab8f29cc4ae73839e51716c0151b..3480c34fa317e5a568d6f414acc206bd2c8b2137 100644 (file)
@@ -19,6 +19,7 @@ use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\App;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Redirect;
+use Illuminate\Support\Facades\Route;
 
 class CubistMagicController extends CubistCrudController
 {
@@ -37,6 +38,31 @@ class CubistMagicController extends CubistCrudController
         parent::__construct();
     }
 
+    // Routes
+//Route::post($this->name . '/bulk-publish', [
+////'as' => 'crud.' . $this->name . '.bulkPublish',
+////'uses' => $this->controller . '@bulkPublish',
+////]);
+////
+////Route::post($this->name . '/bulk-offline', [
+////'as' => 'crud.' . $this->name . '.bulkOffline',
+////'uses' => $this->controller . '@bulkOffline',
+////]);
+////
+////Route::post($this->name . '/bulk-translations-replace', [
+////'as' => 'crud.' . $this->name . '.bulkTranslationsReplace',
+////'uses' => $this->controller . '@bulkTranslationsReplace',
+////]);
+///
+///
+
+    public function setupMediaRoutes($segment, $routeName, $controller)
+    {
+        Route::match(['post'], $segment . '/{id}/media', $controller . '@uploadMedia');
+        Route::match(['delete'], $segment . '/{id}/media/{mediaId}', $controller . '@deleteMedia');
+        Route::match(['post'], $segment . '/{id}/media/{mediaId}', $controller . '@reorderMedia');
+    }
+
     public function _postSetModel()
     {
 
@@ -147,7 +173,7 @@ class CubistMagicController extends CubistCrudController
         }
         $this->crud->addField($field->getDefinition(), $field->getCRUDForm());
 
-        $this->crud->orderFields(['id','variant']);
+        $this->crud->orderFields(['id', 'variant']);
 
         $this->_fields[$field->getAttribute('name')] = $field;
     }
index aa4366b1eb6d9e8cfd9d768ee0b7adf36afd0b8a..3f10aef65976117a391b42d265789d20422f1a23 100644 (file)
@@ -6,7 +6,7 @@ namespace Cubist\Backpack\app\Magic\Fields;
 
 use Illuminate\Support\Facades\App;
 
-class Locale extends SelectFromArray
+class LLocale extends SelectFromArray
 {
     public function __construct($attributes)
     {
index c671c9bc62a01dce6046135071ebe2b07afc984c..685e2efca5f9810a506b2378bd4ef450e3361ffe 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Cubist\Backpack\app\Magic\Models;
 
-use Backpack\CRUD\CrudTrait;
+use Backpack\CRUD\app\Models\Traits\CrudTrait;
 use Cubist\Backpack\app\Magic\BunchOfFields;
 use Cubist\Backpack\app\Magic\Controllers\CubistMagicController;
 use Cubist\Backpack\app\Magic\EntityData;