Skip to content

Commit c973ba8

Browse files
authored
Merge pull request #100 from cruxinator/ExtendRelationType
Extend relation types to include MorphOne
2 parents e86b43d + 1f1a419 commit c973ba8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Models/ForeignRelationship.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ForeignRelationship implements JsonWriter
2727
'hasManyThrough',
2828
'morphTo',
2929
'morphMany',
30+
'morphOne',
3031
'morphToMany',
3132
];
3233

@@ -107,6 +108,7 @@ public function isSingleRelation()
107108
return in_array($this->type, [
108109
'hasOne',
109110
'belongsTo',
111+
'morphOne',
110112
'morphTo',
111113
]);
112114
}
@@ -121,7 +123,7 @@ public function isSingleRelation()
121123
public function setType($type)
122124
{
123125
if (!self::isValidType($type)) {
124-
throw new OutOfRangeException();
126+
throw new \OutOfRangeException();
125127
}
126128

127129
$this->type = $type;

0 commit comments

Comments
 (0)