foreach ($options as $option) {
Log::info($option->id); // вот тут получается достать id
$optionIds[] = $option->id; // происходит что то непонятное
}
Log::info($optionIds); // вот тут выходит непонятно что
[2018-06-01 11:47:53] local.INFO: array (
0 =>
Ramsey\Uuid\Uuid::__set_state(array(
'codec' =>
Ramsey\Uuid\Codec\TimestampFirstCombCodec::__set_state(array(
'builder' =>
Ramsey\Uuid\Builder\DefaultUuidBuilder::__set_state(array(
'converter' =>
Ramsey\Uuid\Converter\Number\BigNumberConverter::__set_state(array(
)),
)),
)),
'fields' =>
array (
'time_low' => '957ab462',
'time_mid' => 'b3ac',
'time_hi_and_version' => '45a6',
'clock_seq_hi_and_reserved' => '8d',
'clock_seq_low' => '45',
'node' => '8af51d8cc3c8',
),
'converter' =>
Ramsey\Uuid\Converter\Number\BigNumberConverter::__set_state(array(
)),
)),
1 => ....
refactorCategories (categories) {
let parents = this.findFirstParents(categories)
parents.forEach(parent => {
parent.children = this.getChildren(categories, parent.id)
})
console.log(parents)
},
getChildren (categories, parentId) {
return categories.filter(category => {
return category.parent_id === parentId
}).map(category => {
category.children = this.getChildren(categories, category.id)
})
refactorCategories (categories) {
console.log(this.getChildren(categories))
},
getChildren (categories, parentId = null) {
categories.forEach(category => {
if (category.parent_id === parentId) {
category.children = this.getChildren(categories, category.parent_id)
}
})
return categories
}
refactorCategories (categories) {
let parents = this.findFirstParents(categories)
parents.forEach(parent => {
parent.children = this.findChildren(categories, parent.id)
})
},
findChildren (array, id) {
return array.filter(item => {
return item.parent_id === id
})
},
findFirstParents (categories) {
return categories.filter(category => {
return !category.parent_id
})
}
Мне интересно безопасно ли вообще таки способом пользоваться или нет