From: Vincent Vanwaelscappel Date: Fri, 28 Feb 2020 15:23:23 +0000 (+0100) Subject: wip #3439 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=46c63e4edd65fd62576b61ff617a104a17d35f42;p=cubist_cms-back.git wip #3439 @0.5 --- diff --git a/src/CubistBackpackServiceProvider.php b/src/CubistBackpackServiceProvider.php index 2e35c3d..a6e5a81 100644 --- a/src/CubistBackpackServiceProvider.php +++ b/src/CubistBackpackServiceProvider.php @@ -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 "make('" . self::NAMESPACE . "::favicon', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>"; }); + + $this->app->extend('crud', function () { + new CubistCrudPanel(); + }); } diff --git a/src/app/Application.php b/src/app/Application.php index 3b5f7d5..b856973 100644 --- a/src/app/Application.php +++ b/src/app/Application.php @@ -1,6 +1,6 @@ entry = null; diff --git a/src/app/Facades/App.php b/src/app/Facades/App.php index cfd6049..3bb381f 100644 --- a/src/app/Facades/App.php +++ b/src/app/Facades/App.php @@ -1,6 +1,6 @@ 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(); - } } diff --git a/src/app/Magic/Controllers/CubistMagicController.php b/src/app/Magic/Controllers/CubistMagicController.php index 418e37a..8ac2ae9 100644 --- a/src/app/Magic/Controllers/CubistMagicController.php +++ b/src/app/Magic/Controllers/CubistMagicController.php @@ -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(); }