Skip to content

Commit

Permalink
Create Twill v3 version of api model patch [WEB-2956]
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgarwood authored and nikhiltri committed Jan 17, 2025
1 parent 99cf0ea commit 6cea83e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions patches/WEB-2301---get-repository-of-API-models.diff
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) {

0 comments on commit 6cea83e

Please sign in to comment.