Laravel 数据库只存储值而不存储数组
Laravel Database storing only value not array
$visitorphonenumber=DB::select('select phonenumber from visitortable where email=?',[Auth::user()->email]);
$booking=new bookingmodel();
$booking->visitorphonenumber=$visitorphonenumber;
这会将 [{"phonenumber":"9874589608"}]
之类的值存储在数据库中,但我只想存储 9874589608
尝试
$visitorphonenumber=DB::select('select phonenumber from visitortable where email=?',[Auth::user()->email]);
$singlePhoneNumber=$visitorphonenumber->first();
我会在上面的答案中加点糖,使用like
$visitorphonenumber->first()->phonenumber;
$visitorphonenumber=DB::select('select phonenumber from visitortable where email=?',[Auth::user()->email]);
$booking=new bookingmodel();
$booking->visitorphonenumber=$visitorphonenumber;
这会将 [{"phonenumber":"9874589608"}]
之类的值存储在数据库中,但我只想存储 9874589608
尝试
$visitorphonenumber=DB::select('select phonenumber from visitortable where email=?',[Auth::user()->email]);
$singlePhoneNumber=$visitorphonenumber->first();
我会在上面的答案中加点糖,使用like
$visitorphonenumber->first()->phonenumber;