--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\Magic\Fields;
+
+
+class ColumnValue extends StaticValue
+{
+ protected $_adminType = 'column_value';
+}
$this->setAttribute('wrapperAttributes', $wrapperAttributes);
}
+ }
+
+ public function setPermissions()
+ {
if (null !== $this->getAttribute('can', null)) {
if (!can($this->getAttribute('can'))) {
$this->setAttribute('preview', false);
if (null !== $this->getAttribute('can_write', null)) {
if (!can($this->getAttribute('can_write'))) {
- $this->setAttribute('type', 'static');
+ $this->setAttribute('type', 'column_value');
$this->setAttribute('view_namespace', CubistBackpackServiceProvider::NAMESPACE . '::fields');
}
}
public function pluck($attr)
{
+ $bui = '';
+ if (backpack_user() !== null) {
+ $bui = backpack_user()->id;
+ }
+
$modelClass = $this->getAttribute('optionsmodel');
- $cacheKey = '_getOption_Model_' . $modelClass . '-' . $attr;
+ $cacheKey = '_getOption_Model_' . $modelClass . '-' . $attr . '-' . $bui;
if (isset(static::$_options[$cacheKey])) {
return static::$_options[$cacheKey];
}
}
$this->fakeColumns = array_unique($this->fakeColumns);
+ if (get_class($this) !== config("auth.providers.users.model")) {
+ foreach ($this->_fields as $name => $field) {
+ $field->setPermissions();
+ }
+ }
}
'type' => 'checkbox',
'tab' => 'Login']);
- $this->addField(['name' => 'rolesandperms',
- 'label' => '',
- 'type' => 'RolesPermissions',
- 'tab' => 'Roles & Permissions']);
-
$this->addField(['name' => 'remember_token',
'type' => 'Text',
'hidden' => true,
$this->addField(['name' => 'password',
'label' => 'Password',
'type' => 'Password',
- 'tab' => 'Login'
+ 'tab' => 'Login',
+ 'can'=>'users:admin'
]);
$this->addField(['name' => 'api_token',
'label' => 'API Token',
'type' => 'APIToken',
- 'tab' => 'Login']);
+ 'tab' => 'Login',
+ 'can'=>'users:admin'
+ ]);
+
+ $this->addField(['name' => 'rolesandperms',
+ 'label' => '',
+ 'type' => 'RolesPermissions',
+ 'tab' => 'Login',
+ 'can'=>'users:admin'
+ ]);
}
}
--- /dev/null
+@php
+ /** @var $entry Cubist\Backpack\Magic\Models\CubistMagicAbstractModel */
+ $column=$entry->getField($field['name'])->getColumnData();
+@endphp
+
+<!-- text input -->
+@include('crud::fields.inc.wrapper_start')
+<label>{!! $field['label'] !!}</label>
+@include('crud::fields.inc.translatable_icon')
+<div>
+ @if (!isset($column['type']))
+ @include('crud::columns.text')
+ @else
+ @if(view()->exists('vendor.backpack.crud.columns.'.$column['type']))
+ @include('vendor.backpack.crud.columns.'.$column['type'])
+ @else
+ @if(view()->exists('crud::columns.'.$column['type']))
+ @include('crud::columns.'.$column['type'])
+ @else
+ @include('crud::columns.text')
+ @endif
+ @endif
+ @endif
+</div>
+{{-- HINT --}}
+@if (isset($field['hint']))
+ <p class="help-block">{!! $field['hint'] !!}</p>
+ @endif
+ </div>
+
+
+
+