This repository has been archived on 2024-03-08. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
website-old/app/models/NewsModel.php
2023-02-17 13:51:13 +01:00

19 lines
No EOL
454 B
PHP

<?php
namespace app\models;
use framework\Collection;
use framework\database\Database;
use framework\database\Model;
use framework\database\Query;
class NewsModel extends Model
{
public static string $tableName = "news";
static function last(int $count = 5): Collection
{
$table = self::tableName();
return self::arrayToModel(Database::query(new Query("SELECT * FROM `$table` ORDER BY `date` DESC LIMIT $count")));
}
}