📜  laravel 映射 api 的输出 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:37.105000             🧑  作者: Mango

代码示例1
Booking::select(['booking_date', 'pickup_datetime'])->get()
  ->map(function ($booking) {
      $booking->pickup_datetime = optional($booking->pickup_time)->format('d M Y, h:i A');
      $booking->booking_date = optional($booking->created_at)->format('d M Y, h:i A');
      return $booking;
  });