"userS": {
"email": "[email protected]",
"name": "jack"
}
Above is array of object in my laravel 6. it is stored in session array
i want to use email so i am doing this
$sessionUser=Session::get('userS');
$sessionEmail=$sessionUser['email'];
it gives me email properly in string.
so i am finding the user ID in user table who have this email
following query gives uid in array/object fromat
$uid=customerModel::where('email',$sessionEmail)->pluck('uid');
or
$uid=DB::select('select uid from user where email=:Email',['Email'=>$sessionEmail]);
but it gives me [1] or [{"uid":1}]
(here 1 is uid which i want to use but it is in array format)
when i insert all records then it gives me following error
Incorrect integer value: '[1]' for column ecart.tblorder.uid at row 1 (SQL: insert into tblorder (uid, pid, quantity, customer_name, customer_email, customer_mobile, pincode, address, date) values ([1], 2, 2, john, [email protected], 7458965874, 123456, testXYZ, 2020-06-29 13:01:40))
i want simple uid not in array or object fromat
my sql query should be like
SQL: insert into `tblorder` (`uid`, `pid`, `quantity`, `customer_name`, `customer_email`, `customer_mobile`, `pincode`, `address`, `date`) values (1, 2, 2, john, [email protected], 7458965874, 123456, testXYZ, 2020-06-29 13:01:40)