Files
coolcoth.com/app/Models/News.php
T
2026-08-08 15:53:53 +08:00

17 lines
338 B
PHP

<?php
namespace App\Models;
use Core\Model;
class News extends Model
{
protected $table = 'news';
protected $orderBy = 'published_at';
public function published(int $limit = 20): array
{
$all = array_filter($this->all(), fn($n) => ($n['status'] ?? 1) == 1);
return array_slice($all, 0, $limit);
}
}