-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Twill v3 version of api model patch [WEB-2956]
- Loading branch information
1 parent
99cf0ea
commit 6cea83e
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
diff --git a/src/Repositories/ModuleRepository.php b/src/Repositories/ModuleRepository.php | ||
index cb6986e0..bf268cc9 100644 | ||
index 47e56466..5172e25d 100644 | ||
--- a/src/Repositories/ModuleRepository.php | ||
+++ b/src/Repositories/ModuleRepository.php | ||
@@ -867,6 +867,8 @@ abstract class ModuleRepository | ||
if (!$modelOrRepository) { | ||
if (class_exists($relation) && (new $relation) instanceof Model) { | ||
$modelOrRepository = str_after_last($relation, '\\'); | ||
+ } elseif (class_exists($relation) && (new $relation) instanceof \App\Libraries\Api\Models\BaseApiModel) { | ||
+ $modelOrRepository = 'Api\\' .str_after_last($relation, '\\'); | ||
@@ -696,6 +696,8 @@ abstract class ModuleRepository | ||
if (! $modelOrRepository) { | ||
if (class_exists($relation) && (new $relation()) instanceof Model) { | ||
$modelOrRepository = Str::afterLast($relation, '\\'); | ||
+ } elseif (class_exists($relation) && (new $relation()) instanceof \App\Libraries\Api\Models\BaseApiModel) { | ||
+ $modelOrRepository = 'Api\\' . Str::afterLast($relation, '\\'); | ||
} else { | ||
$morphedModel = Relation::getMorphedModel($relation); | ||
if (class_exists($morphedModel) && (new $morphedModel) instanceof Model) { | ||
if (class_exists($morphedModel) && (new $morphedModel()) instanceof Model) { |