I am new in laravel, I want to convert SQL result to string in laravel, below is what I did even though I dont get the result a desire, that is returning client_name as a string.
$client_name = DB::table('utility_data')
->select('client_name')
->where('identity_number', '=', $identity_number)
first();
dd($client_name);
Above script select client name from the database, I want to convert that value to a string, any idea on how to achieve this? This is what I get as result,
I want to extract the value "Nosi Chefane":
{#303 ▼
+"client_name": "Nosi Chefane"
}
>Solution :
If you printing it from a controller, just use return $client_name and you should see the data as a JSON object