Skip to content

Commit

Permalink
add get pivot class method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 8, 2018
1 parent 4777740 commit 641d087
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\ModelNotFoundException;

class BelongsToMany extends Relation
Expand Down Expand Up @@ -266,6 +267,16 @@ protected function buildDictionary(Collection $results)
return $dictionary;
}

/**
* Get the class being used for pivot models.
*
* @return string
*/
public function getPivotClass()
{
return $this->using ?? Pivot::class;
}

/**
* Specify the custom pivot model to use for the relationship.
*
Expand Down

0 comments on commit 641d087

Please sign in to comment.