UserResource.php 511 B

12345678910111213141516171819202122232425
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace App\Http\Resources;
  11. use Illuminate\Http\Resources\Json\JsonResource;
  12. class UserResource extends JsonResource
  13. {
  14. public function toArray($request)
  15. {
  16. return [
  17. 'nickname' => $this->name,
  18. 'email' => $this->email,
  19. ];
  20. }
  21. }