Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
Adding support for correct params on Belongs To relations. localKey w…
Browse files Browse the repository at this point in the history
…as renamed to otherKey, as the original Eloquent method
  • Loading branch information
igorsantos07 committed May 10, 2015
1 parent 5d1b262 commit 5e8ef76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/LaravelBook/Ardent/Ardent.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,13 @@ protected function handleRelationalArray($relationName) {
switch ($relationType) {
case self::HAS_ONE:
case self::HAS_MANY:
case self::BELONGS_TO:
$verifyArgs(['foreignKey', 'localKey']);
return $this->$relationType($relation[1], $relation['foreignKey'], $relation['localKey']);

case self::BELONGS_TO:
$verifyArgs(['foreignKey', 'otherKey', 'relation']);
return $this->$relationType($relation[1], $relation['foreignKey'], $relation['otherKey'], $relation['relation']);

case self::BELONGS_TO_MANY:
$verifyArgs(array('table', 'foreignKey', 'otherKey'));
$relationship = $this->$relationType($relation[1], $relation['table'], $relation['foreignKey'], $relation['otherKey']);
Expand Down

0 comments on commit 5e8ef76

Please sign in to comment.