Files
Belupeti 5d5250287d
Build / Build-image (push) Successful in 1m13s
wordle backend and some frontend changes
2026-08-27 22:33:19 +02:00

37 lines
831 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Tla extends Model
{
protected $table = 'tla';
use HasFactory;
protected $fillable = ['acronym', 'hint', 'language', 'used', 'context', 'submitter', 'likes', 'dislikes'];
public static function GetCurrentTla( string $language ) {
$tla = Tla::where('used', date("Y-m-d"))
->where('language', $language)
->first();
if ( is_null($tla) ) {
$tla = Tla::where('language', $language)
->where('used', NULL)
->inRandomOrder()
->first();
if ($tla == NULL) return NULL;
$tla->used = date("Y-m-d");
$tla->save();
}
return $tla;
}
}