protected $_oneInstance;
protected $_nested = false;
- // Routes
-////Route::post($this->name . '/bulk-translations-replace', [
-////'as' => 'crud.' . $this->name . '.bulkTranslationsReplace',
-////'uses' => $this->controller . '@bulkTranslationsReplace',
-////]);
-///
-///
-///
-///
-///
-///
-
-
public function _postSetModel()
{
| CrudPanel Configuration
|--------------------------------------------------------------------------
*/
-
-
$this->crud->addColumn(['name' => $model->getPrimaryKey(), 'type' => 'number', 'label' => "#", 'searchLogic' => 'text']);
+ $this->getModelInstance()->setupButtons($this->crud);
+
$this->updateFieldsFromModel($model);
}
namespace Cubist\Backpack\app\Magic\Models;
+use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Cubist\Backpack\app\Magic\BunchOfFields;
use Cubist\Backpack\app\Magic\Controllers\CubistMagicController;
public $timestamps = true;
public $clonable = true;
+ protected $_baseController = CubistMagicController::class;
+
/**
* @var array
*/
}
public function __construct(array $attributes = [])
+ {
+
+ $this->setup();
+ $this->fill($attributes);
+ }
+
+ public function setup()
{
$this->setFields();
$this->postSetFields();
$this->bootIfNotBooted();
$this->initializeTraits();
$this->syncOriginal();
- $this->fill($attributes);
+ }
+
+ /**
+ * @param $crud CrudPanel
+ */
+ public function setupButtons($crud)
+ {
+
+ }
+
+ /**
+ * @param $crud CrudPanel
+ */
+ public function setupFilters($crud)
+ {
+
}
public function newFromBuilder($attributes = [], $connection = null)
*/
protected function _getBaseController()
{
- return 'CubistMagicController';
+ return $this->_baseController;
}
protected function _replaceInCode($stub, $dest)
namespace Cubist\Backpack\app\Magic\Models;
+use Cubist\Backpack\app\Magic\Controllers\CubistMagicNestedController;
+
class CubistMagicNestedModel extends CubistMagicPageModel
{
+ protected $_baseController = CubistMagicNestedController::class;
+
public function setSchema($schema)
{
$table = parent::setSchema($schema);
return $table;
}
- /**
- * @return string
- */
- protected function _getBaseController()
- {
- return 'CubistMagicNestedController';
- }
-
-
public static function getTree()
{
- try{
+ try {
$all = self::orderBy('lft')->get();
- }catch (\Exception $e){
- $all=[];
+ } catch (\Exception $e) {
+ $all = [];
}
$res = [];
self::_appendToTree($res, null, $all);
namespace App\Http\Controllers\Admin;
-use Cubist\Backpack\app\Magic\Controllers\_EXTENDS_;
-
class _CONTROLLERCLASS_ extends _EXTENDS_
{
protected $_modelNamespace = '_MODELNAMESPACE_';