From 641d0875a25ff153c4b2b7292b1d6c4ea717cb66 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 8 Jan 2018 16:06:48 -0600 Subject: [PATCH] add get pivot class method --- .../Database/Eloquent/Relations/BelongsToMany.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php index dd2863d20ae2..0f723a539ac6 100755 --- a/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php +++ b/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php @@ -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 @@ -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. *