$visitorphonenumber=DB::select('select phonenumber from visitortable where email=?',[Auth::user()->email]);
$booking=new bookingmodel();
$booking->visitorphonenumber=$visitorphonenumber;
这会将[{"phonenumber":"9874589608"}]
之类的值存储在数据库中,但我只想存储9874589608
答案 0 :(得分:2)
我会在上面添加一些糖,就像
一样$visitorphonenumber->first()->phonenumber;
答案 1 :(得分:1)
尝试
$visitorphonenumber=DB::select('select phonenumber from visitortable where email=?',[Auth::user()->email]);
$singlePhoneNumber=$visitorphonenumber->first();