将全名拆分为第一个和中间+最后一个集合中的 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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...