123456789101112131415161718192021222324252627 |
- <?php
- /*
- * This file is part of the Jiannei/lumen-api-starter.
- *
- * (c) Jiannei <longjian.huang@foxmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- namespace App\Http\Resources;
- use Illuminate\Http\Resources\Json\ResourceCollection;
- class UserCollection extends ResourceCollection
- {
- public function toArray($request)
- {
- return $this->collection->map(function ($item) {
- return [
- 'nickname' => $item->name,
- 'email' => $item->email,
- ];
- })->all();
- }
- }
|