文件还在测试中
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user