From: Vincent Vanwaelscappel Date: Wed, 5 Jun 2019 15:50:19 +0000 (+0200) Subject: #2810 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=df9c1e8fdaa9872b880080e1c0d13761760f103e;p=cubist_cms-back.git #2810 --- diff --git a/src/app/Magic/Controllers/CubistMagicControllerTrait.php b/src/app/Magic/Controllers/CubistMagicControllerTrait.php index 636975d..ede1b0c 100644 --- a/src/app/Magic/Controllers/CubistMagicControllerTrait.php +++ b/src/app/Magic/Controllers/CubistMagicControllerTrait.php @@ -17,7 +17,6 @@ trait CubistMagicControllerTrait if (!$this->_plural) { $this->_plural = $this->_singular . 's'; } - if ($this->_clonable) { $this->crud->allowAccess('clone'); } diff --git a/src/app/Magic/Models/CubistMagicAbstractModel.php b/src/app/Magic/Models/CubistMagicAbstractModel.php index 97fe1f7..62fcd96 100644 --- a/src/app/Magic/Models/CubistMagicAbstractModel.php +++ b/src/app/Magic/Models/CubistMagicAbstractModel.php @@ -305,7 +305,7 @@ class CubistMagicAbstractModel extends Model { foreach ($this->_relationships as $relationship) { /** @var $relationship Field */ - if ($method == $relationship->getAttribute('name')) { + if ($method == $relationship->getAttribute('entity')) { return $this->relationship($relationship); } } @@ -323,7 +323,7 @@ class CubistMagicAbstractModel extends Model case 'belongsTo': return $this->belongsTo($field->getAttribute('model'), $field->getAttribute('name')); case 'belongsToMany': - return $this->belongsToMany($field->getAttribute('model'), $this->getRelationShipTable($field))->withPivot([$this->getForeignKey(), self::_toModel($field->getAttribute('model'))->getForeignKey()]); + return $this->belongsToMany($field->getAttribute('model'), $this->getRelationShipTable($field)); } }