BikeOnlineResource.php 669 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Http\Resources\App;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class BikeOnlineResource extends JsonResource
  5. {
  6. /**
  7. * Transform the resource into an array.
  8. *
  9. * @param \Illuminate\Http\Request $request
  10. * @return array
  11. */
  12. public function toArray($request)
  13. {
  14. $model = $this->resource;
  15. $data = [
  16. 'reason' => $model->reason,
  17. 'name' => $model->name,
  18. 'created_at' => date("Y-m-d H:i:s", strtotime($model->created_at)),
  19. 'username' => $model->workers->name,
  20. 'mobile' => $model->workers->phone
  21. ];
  22. return $data;
  23. }
  24. }