]> _ Git - cubist_cms-back.git/commitdiff
wip #3753 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 2 Dec 2020 12:37:06 +0000 (13:37 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 2 Dec 2020 12:37:06 +0000 (13:37 +0100)
src/app/Magic/Models/CubistMagicAbstractModel.php

index 0f85f6a5d5a17f608175563e40b57650d5d77218..bf1d800e06c735f1e4b39dd96460cec7f1611b83 100644 (file)
@@ -56,7 +56,7 @@ class CubistMagicAbstractModel extends Model implements HasMedia
     protected $_enableCreation = true;
     protected $_enableRevisions = true;
     protected $_enableBulk = true;
-    protected static $_ownerAttribute = 'owner';
+    protected static $_ownerAttribute = null;
 
     protected $_syncDbSchema = true;
 
@@ -91,15 +91,13 @@ class CubistMagicAbstractModel extends Model implements HasMedia
     public static function boot()
     {
         parent::boot();
-
-        static::addGlobalScope('userfilter', function (Builder $builder) {
+        static::addGlobalScope('ownerclause', function (Builder $builder) {
             static::addOwnerClause($builder);
         });
     }
 
     public static function addOwnerClause(Builder $builder)
     {
-        $builder->where(static::$_ownerAttribute, backpack_user()->id);
     }
 
     public function __construct(array $attributes = [])
@@ -302,8 +300,8 @@ class CubistMagicAbstractModel extends Model implements HasMedia
             $cast = $field->getAttribute('cast', false);
             if ($cast !== false) {
                 if (is_array($cast)) {
-                    foreach ($cast as $name => $type) {
-                        $this->casts[$name] = $type;
+                    foreach ($cast as $n => $t) {
+                        $this->casts[$n] = $t;
                     }
                 } else {
                     $this->casts[$field->getAttribute('name')] = $cast;