I'm trying to store my fetched value in a variable inside laravel controller. following is my code for fetching the value and store it in a variable.
$get_domain=Website::select('domain')->where('appId', '=',$id)->get();
echo $get_domain;
die();
Once I print this value it gives me some thing like follows,
[{"domain":"puka2"}]
But I need to store only the "puka2" in my variable
I know how to echo only that value in the blade but I'm struggling storing the value in the controller
How to store that value only in that variable inside the controller?
you could do it using pluck
$value= $get_domain=Website::select('domain')->firstWhere('appId', '=',$id);
if($value!=null)
$value=$value->pluck('domain')->first();
now, $value will hold the string you want