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
{
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();
+ });
}
<?php
-namespace Cubist\Backpack;
+namespace Cubist\Backpack\app;
class Application extends \Illuminate\Foundation\Application
{
<?php
-namespace Cubist\Backpack;
+namespace Cubist\Backpack\app;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel;
return false;
}
- public function setModel($model_namespace)
- {
- parent::setModel($model_namespace);
- }
-
public function updateEntry()
{
$this->entry = null;
<?php
-namespace Cubist\Backpack\Facades;
+namespace Cubist\Backpack\app\Facades;
use Illuminate\Support\Facades\App as Base;
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();
- }
}
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',
public function setup()
{
+ dd('setup');
+ $this->crud->setModel($this->_modelNamespace);
+ $this->_postSetModel();
+
+ $model = $this->getModelInstance();
+
parent::setup();
+
if (!$this->_routeURL) {
$this->_routeURL = $this->_singular;
}
// $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();
}