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 13, 2025
1 parent f674ac6 commit ad710ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 ad710ef

Please sign in to comment.