问题描述
我想在我的集合中将全名拆分为名字和(中间名 + 姓氏)以进行 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 (将#修改为@)