mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-25 09:10:25 +01:00
Working and optimise
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
import Translation from "App/Models/Translation";
|
||||
|
||||
export default async function getTranslation(code: string): Promise<Translation> {
|
||||
let translation = await Translation.findBy('code', code)
|
||||
if (!translation) {
|
||||
translation = await Translation.create({code: code})
|
||||
}
|
||||
return translation
|
||||
return await Translation.firstOrNew({code}, {code})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user