|
@@ -48,6 +48,10 @@ class StarNewsRepository
|
|
|
'sort' => $request['sort'] ?? 0,
|
|
|
'status' => $request['status'] ?? 0,
|
|
|
];
|
|
|
+ $open_news = $this->starNews->where('status',1)->count();
|
|
|
+ if ($open_news >= 5 && $request['status'] == 1){
|
|
|
+ throw new HttpException(500, '最多开启5条新闻');
|
|
|
+ }
|
|
|
|
|
|
if (!$this->starNews->create($data)) {
|
|
|
throw new HttpException(500, '添加失败');
|