文件还在测试中
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use Core\Model;
|
||||
|
||||
/**
|
||||
* 客户案例模型(table = cases,避开 PHP 关键字 case)
|
||||
* 与 News 同构:支持 status 展示开关、按 published_at 排序。
|
||||
*/
|
||||
class CustomerCase extends Model
|
||||
{
|
||||
protected $table = 'cases';
|
||||
protected $orderBy = 'published_at';
|
||||
|
||||
public function published(int $limit = 20): array
|
||||
{
|
||||
$all = array_filter($this->all(), fn($c) => ($c['status'] ?? 1) == 1);
|
||||
return array_slice($all, 0, $limit);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user