1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-26 04:21:27 +08:00
2020-07-07 20:44:26 +08:00

46 lines
848 B
PHP

<?php
namespace App\Services\Frontend\Help;
use App\Models\Help as HelpModel;
use App\Repos\Help as HelpRepo;
use App\Services\Frontend\Service as FrontendService;
class HelpList extends FrontendService
{
public function handle()
{
$helpRepo = new HelpRepo();
$params = ['published' => 1];
$helps = $helpRepo->findAll($params);
if ($helps->count() > 0) {
return $this->handleHelps($helps);
}
}
/**
* @param HelpModel[] $helps
* @return array
*/
protected function handleHelps($helps)
{
$items = [];
foreach ($helps as $help) {
$items[] = [
'id' => $help->id,
'title' => $help->title,
'content' => $help->content,
];
}
return $items;
}
}