class Field implements \ArrayAccess
{
use CubistMagicAttribute;
+
protected $_attributes;
protected $_rules = [];
+ protected $_isRelationship = false;
+
protected $_columnType = 'text';
protected $_columnMoveAfter = false;
protected $_columnFormat = null;
protected $_databaseUnique = false;
protected $_databaseIndex = false;
- /** @var bool|string|array */
+ /** @var bool|string|array */
protected $_cast = false;
protected $_translatable = false;
protected $_migrateTranslatable = false;
return $value;
}
+ public function isRelationship()
+ {
+ return $this->_isRelationship;
+ }
+
}
namespace Cubist\Backpack\app\Magic\Fields;
-use Illuminate\Support\Str;
class RolesPermissions extends Field
{
protected $_adminType = 'checklist_dependency';
protected $_cast = ['roles' => 'json', 'permissions' => 'json'];
+ protected $_isRelationship = true;
public function getDefinition()
{
if (!in_array($store_in, $this->fakeColumns)) {
$this->fakeColumns[] = $store_in;
}
- } else {
+ } else if (!$field->isRelationship()) {
if ($field->getAttribute('fillable')) {
$this->fillable[] = $name;
}
return $field;
}
- /**
- * @param $field Field
- */
- protected function _addRelationship($field)
- {
- $this->_relationships[] = $field;
- }
-
public function generateCode()
{
$this->_generateControllerCode();
$table->setPrimaryKey([$this->primaryKey], 'pk_' . $this->table);
foreach ($this->_fields as $field) {
- if ($field->getAttribute('fake', false) !== false) {
+ if ($field->getAttribute('fake', false) !== false) {
continue;
}
$field->defineDbColumn($table);
'type' => 'checkbox',
'tab' => 'Login']);
- $this->addField(['name' => 'roles_and_permissions',
+ $this->addField(['name' => 'rolesandperms',
'label' => '',
'type' => 'RolesPermissions',
'tab' => 'Roles & Permissions']);
return [
'internal_search' => env('CUBIST_INTERNAL_SEARCH', false),
'internal_search_index' => env('CUBIST_INTERNAL_SEARCH_INDEX', strtolower(env('APP_NAME', 'App_name') . '_' . env('APP_ENV', 'dev'))),
- 'page_model' => '\App\Models\Page',
- 'settings_model' => '\App\Models\Settings',
- 'locale_model' => '\App\Models\Locale',
+ 'page_model' => App\Models\Page::class,
+ 'settings_model' => App\Models\Settings::class,
+ 'locale_model' => App\Models\Locale::class,
'seo_robots' => env('SEO_ROBOTS', true),
];