Does anyone have an idea why I am getting this kind of array? I only want this below part. I need to remove those mysql connection and other unwanted arrays from this.
array (
'name' => 'Westwood',
'id' => 538,
),
0 =>
Common\Models\Property::__set_state(array(
'connection' => 'mysql',
'table' => NULL,
'primaryKey' => 'id',
'keyType' => 'int',
'incrementing' => true,
'with' =>
array (
),
'perPage' => 15,
'exists' => true,
'wasRecentlyCreated' => false,
'attributes' =>
array (
'name' => 'Westwood',
'id' => 538,
),
'guarded' =>
array (
0 => '*',
),
)),
The below code shows what I did to get that array. when I Log::info($results);
I get that array hope you understand my question.
$properties = model::where('status', '=', 'Active')
->get();
if($jsonData->city !== "") {
foreach ($properties as $property) {
if($property->city === $jsonData->city) {
$results[] = $property;
}
}
}