]> _ Git - cubist_cms-back.git/commitdiff
wip #3439 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Feb 2020 15:23:23 +0000 (16:23 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Feb 2020 15:23:23 +0000 (16:23 +0100)
src/CubistBackpackServiceProvider.php
src/app/Application.php
src/app/CubistCrudPanel.php
src/app/Facades/App.php
src/app/Http/Controllers/CubistCrudController.php
src/app/Magic/Controllers/CubistMagicController.php

index 2e35c3d1340ca25408bdb959fd7afe09a564191e..a6e5a81cc556eb69152c1a7046e6b253975d7dfa 100644 (file)
@@ -11,6 +11,7 @@ use Cubist\Backpack\app\Console\Commands\SearchIndexCommand;
 use Cubist\Backpack\app\Console\Commands\UpdateCommand;
 use Illuminate\Support\Facades\Blade;
 use Illuminate\Support\ServiceProvider;
+use Cubist\Backpack\app\CubistCrudPanel;
 
 class CubistBackpackServiceProvider extends ServiceProvider
 {
@@ -47,6 +48,10 @@ class CubistBackpackServiceProvider extends ServiceProvider
         Blade::directive('favicon', function () {
             return "<?php echo \$__env->make('" . self::NAMESPACE . "::favicon', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>";
         });
+
+        $this->app->extend('crud', function () {
+            new CubistCrudPanel();
+        });
     }
 
 
index 3b5f7d5849af09597564c117d7d8b24e20bfbb4c..b8569736424a665182700fdd56d1a2857b3e96b0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Cubist\Backpack;
+namespace Cubist\Backpack\app;
 
 class Application extends \Illuminate\Foundation\Application
 {
index c22ad29597cf93882050fbbf1a3fafd441523bfe..bf100db98afd50fc244c175505acd62dac8f3a98 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Cubist\Backpack;
+namespace Cubist\Backpack\app;
 
 use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
 use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel;
@@ -30,11 +30,6 @@ class CubistCrudPanel extends CrudPanel
         return false;
     }
 
-    public function setModel($model_namespace)
-    {
-        parent::setModel($model_namespace);
-    }
-
     public function updateEntry()
     {
         $this->entry = null;
index cfd60490d00f3716de35eec67954bb44a51ada36..3bb381fbbf1571f4e6d3ac902b2ccb6be2d0c424 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Cubist\Backpack\Facades;
+namespace Cubist\Backpack\app\Facades;
 
 use Illuminate\Support\Facades\App as Base;
 
index 8d3cb905cd0cdc57f583fc75c7c84888b2f9788d..40f35ded949c72291e238fb59e3a04981efe3b60 100644 (file)
@@ -29,28 +29,4 @@ class CubistCrudController extends CrudController
     use BulkCloneOperation;
     use RevisionsOperation;
     use BulkPublishOperation;
-
-    public function __construct()
-    {
-        if ($this->crud) {
-            return;
-        }
-
-        // call the setup function inside this closure to also have the request there
-        // this way, developers can use things stored in session (auth variables, etc)
-        $this->middleware(function ($request, $next) {
-            // make a new CrudPanel object, from the one stored in Laravel's service container
-            $this->crud = app()->make(CubistCrudPanel::class);
-            // ensure crud has the latest request
-            $this->crud->setRequest($request);
-            $this->request = $request;
-            $this->setupDefaults();
-            $this->setup();
-            $this->setupConfigurationForCurrentOperation();
-
-            return $next($request);
-        });
-
-        parent::__construct();
-    }
 }
index 418e37af6909f26d08760b84f9b628bf8d1e60a0..8ac2ae9255799d471c79828de2a6870a18ec5126 100644 (file)
@@ -32,16 +32,6 @@ class CubistMagicController extends CubistCrudController
     protected $_nested = false;
 
     // 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',
@@ -69,8 +59,15 @@ class CubistMagicController extends CubistCrudController
 
     public function setup()
     {
+        dd('setup');
+        $this->crud->setModel($this->_modelNamespace);
+        $this->_postSetModel();
+
+        $model = $this->getModelInstance();
+
         parent::setup();
 
+
         if (!$this->_routeURL) {
             $this->_routeURL = $this->_singular;
         }
@@ -101,26 +98,10 @@ class CubistMagicController extends CubistCrudController
 //        $this->crud->with('revisionHistory');
 
 
-        /*
-        |--------------------------------------------------------------------------
-        | CrudPanel Basic Information
-        |--------------------------------------------------------------------------
-        */
-        $this->crud->setModel($this->_modelNamespace);
-        $this->_postSetModel();
-
-        $model = $this->getModelInstance();
-
         if ($this->_bulk) {
-
-            if ($this->_clonable) {
-                $this->crud->addButton('bottom', 'bulk_clone', 'view', 'crud::buttons.bulk_clone', 'beginning');
-            }
-
             if ($model->translationEnabled()) {
                 $this->crud->addButton('bottom', 'bulk_translate', 'view', CubistBackpackServiceProvider::NAMESPACE . '::buttons.bulk_translate', 'begining');
             }
-            $this->crud->addBulkDeleteButton();
         }