Skip to content

Commit

Permalink
Merge pull request #10 from lapig-ufg/develop
Browse files Browse the repository at this point in the history
Article And Methodology Update
  • Loading branch information
James-jamames authored Oct 23, 2023
2 parents 904f5ea + ac3e285 commit a67de8b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
14 changes: 12 additions & 2 deletions server/app/Models/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class Article extends Model
'description',
'authors',
'image',
'url',
'file_pt',
'file_en',
];

public static function getTranslate(string $lang)
Expand All @@ -32,7 +33,16 @@ public static function getTranslate(string $lang)
$article[$translation->column_name] = $translation->value;
}

unset($article->translations);
if($lang == "en")
{
$article["file"] = $article->file_en;
}
else
{
$article["file"] = $article->file_pt;
}

unset($article->translations, $article->file_pt, $article->file_en);
}

return $articles;
Expand Down
11 changes: 10 additions & 1 deletion server/app/Models/Methodology.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ public static function getTranslate(string $lang)
$methodology[$translation->column_name] = $translation->value;
}

unset($methodology->translations);
if($lang == "en")
{
$methodology["file"] = $methodology->file_en;
}
else
{
$methodology["file"] = $methodology->file_pt;
}

unset($methodology->translations, $methodology->file_pt, $methodology->file_en);
}

return $methodologies;
Expand Down

0 comments on commit a67de8b

Please sign in to comment.