protected $_databaseUnique = false;
protected $_databaseIndex = false;
+ /** @var bool|string|array */
protected $_cast = false;
protected $_translatable = false;
protected $_migrateTranslatable = false;
{
return $value;
}
+
}
namespace Cubist\Backpack\app\Magic\Fields;
+use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel;
+
class RolesPermissions extends Field
{
protected $_adminType = 'checklist_dependency';
+ protected $_cast = ['roles' => 'array', 'permissions' => 'array'];
public function getDefinition()
{
if ($field->getAttribute('hidden')) {
$this->hidden[] = $name;
}
- if ($field->getAttribute('cast', false) !== false) {
- $this->casts[$field->getAttribute('name')] = $field->getAttribute('cast');
+ $cast=$field->getAttribute('cast', false)
+ if ($cast!== false) {
+ if(is_array($cast)){
+ foreach ($cast as $name=>$type) {
+ $this->casts[$name] = $type;
+ }
+ }else {
+ $this->casts[$field->getAttribute('name')] = $cast;
+ }
}
}
-
return $field;
}