Skip to content

Commit

Permalink
Merge pull request #11 from lapig-ufg/develop
Browse files Browse the repository at this point in the history
+ Articles update
  • Loading branch information
James-jamames authored Oct 26, 2023
2 parents a67de8b + b96d012 commit 1241bcf
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions server/app/Models/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ class Article extends Model
{
use HasFactory, Translatable;

protected $translatable = ['title', 'description'];
protected $translatable = ['title', 'abstract'];
protected $table = "articles";

protected $fillable = [
'title',
'description',
'abstract',
'authors',
'image',
'file_pt',
'file_en',
'doi',
];

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

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

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

return $articles;
Expand Down

0 comments on commit 1241bcf

Please sign in to comment.