如何解决将全名拆分为第一个和中间+最后一个集合中的 Excel 导出
我想在我的集合中将全名拆分为名字和(中间名 + 姓氏)以进行 Excel 导出。我有以下代码从我的数据库中收集数据并将其导出到 Excel 文件中。
public function collection()
{
return DB::table('bookings')->select(
'bookings.id','bookings.place_id','bookings.payer_name','bookings.user_fullname','bookings.user_email','bookings.user_phone','bookings.user_no_of_guest','bookings.user_no_of_babies','bookings.user_checkin','bookings.user_checkout','bookings.is_approved','promo_codes.promo_type','bookings.user_payment_type','bookings.user_booking_tracking_id','bookings.created_at','bookings.paid_ammount'
)
->whereRaw('"' . $this->date . '" between `user_checkin` and `user_checkout`')
//->whereRaw('? between user_checkin and user_checkout',$this->date) This works
->leftJoin('promo_codes','bookings.user_promo','=','promo_codes.promocode')
->get();
}
全名由名字+姓氏组成,但有时,还有一个中间名,所以我想知道集合中是否有办法将名字拆分为名字+名字剩下的任何内容。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。