показывает "array_unshift (), ожидает параметров 1, который будет массив, нулевой" < /p>
Вот мой Код: < /p>
Код: Выделить всё
public function index($child = null)
{
$crumbs = [];
function getParents($id){
$parent = Instrument::where('id', $id)->first(['id', 'title', 'parent']);
if($parent->parent != null){
array_unshift($crumbs, $parent);
getParents($parent->parent);
}
}
if($child != null){
getParents($child);
}
//return code here
}
Подробнее здесь: https://stackoverflow.com/questions/734 ... null-given
Мобильная версия