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

Fix to #211 #226

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/LaravelBook/Ardent/Ardent.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,18 +414,11 @@ public function morphTo($name = null, $type = null, $id = null) {
{
$backtrace = debug_backtrace(false);
$caller = ($backtrace[1]['function'] == 'handleRelationalArray')? $backtrace[3] : $backtrace[1];

$name = snake_case($caller['function']);
}

// Next we will guess the type and ID if necessary. The type and IDs may also
// be passed into the function so that the developers may manually specify
// them on the relations. Otherwise, we will just make a great estimate.
list($type, $id) = $this->getMorphs($name, $type, $id);

$class = $this->$type;
return parent::morphTo($name, $type, $id);

return $this->belongsTo($class, $id);
}

/**
Expand Down