Beispiel #1
0
 public function __construct($currentModel, $relatedModel, $middleTable, $currentForeignKey, $relatedForeignKey, $currentKey, $relatedKey, $middleModel = null)
 {
     $this->middleTable = $middleTable;
     $this->currentForeignKey = $currentForeignKey;
     $this->relatedForeignKey = $relatedForeignKey;
     $this->currentKey = $currentKey;
     $this->relatedKey = $relatedKey;
     if (is_null($middleModel)) {
         $this->pivot = (new Model())->table($middleTable);
     } else {
         $this->pivot = $middleModel;
     }
     parent::__construct($currentModel, $relatedModel);
     $this->addConstraintsForPivot();
 }
Beispiel #2
0
 public function __construct($currentModel, $relatedModel, $currentKey, $relatedKey)
 {
     $this->relatedKey = $relatedKey;
     $this->currentKey = $currentKey;
     parent::__construct($currentModel, $relatedModel);
 }