I have my web application running on server. I tested the code in local and it works fine. I'm getting id as int from local server but string in hosted server.
Using PHP 7.3
$data = DB::table('users')
->select('id')
->get();
$data = $data->pluck(id);
(Local) output => [1,2,3]
(Hosted) output => ["1","2","3"]
Can any one help to resolve this issue? I can do loop to type cast but there are 100's for function in my controller. It is not possible to type cast each query.
You can use casting Attribute Casting in your model
protected $casts = [
'field_name1' => 'integer',
];