阶段更新

This commit is contained in:
2023-01-12 14:47:38 +08:00
parent 088dd64b2f
commit 5b8901281c
626 changed files with 39326 additions and 12 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace Modules\Cms\Http\Resources;
use Illuminate\Http\Resources\Json\ResourceCollection;
class ArticleCollection extends ResourceCollection
{
public function toArray($request): array
{
return [
'data' => $this->collection->map(function ($article) {
return new ArticleBaseResource($article);
}),
'page' => $this->page(),
];
}
protected function page(): array
{
return [
'current' => $this->currentPage(),
'total_page' => $this->lastPage(),
'per_page' => $this->perPage(),
'has_more' => $this->hasMorePages(),
'total' => $this->total(),
];
}
}