atayahmet / laravel-nestable

Laravel 5 nested category/menu generator
MIT License
214 stars 52 forks source link

NestableService.php#303 count(): Parameter must be an array or an object that implements Countable #42

Closed DmitrySkibitsky closed 6 years ago

DmitrySkibitsky commented 6 years ago

Before the update worked

composer.json
"atayahmet/laravel-nestable": "^0.8.4",
count(): Parameter must be an array or an object that implements Countable
/srv/http/projects/artvitrina/vendor/atayahmet/laravel-nestable/src/Services/NestableService.php#303
ErrorException
            $tree = $first ? '<select '.$this->addAttributes().' ' : '';
        }
        // if pass array data to selected method procces will generate multiple dropdown menu.
        if ($first && (count($this->selected) > 1 || $this->multiple == true)) {
            $tree .= ' multiple';
        }
DmitrySkibitsky commented 6 years ago

$result = \Nestable::make($prepare_data);
dd($result);

NestableService {#1293 ▼
  #config: array:7 [▶]
  #parent: "parent_id"
  #parents: null
  #dropdownAttr: []
  #selected: false
  #placeholder: []
  #optionAttr: null
  #optionUlAttr: null
  #active: false
  #multiple: false
  +data: Collection {#1294 ▶}
  #route: false
  #customUrl: null
  #macros: null
  +"primary_key": "id"
}

dd($result->renderAsDropdown());
count(): Parameter must be an array or an object that implements Countable
atayahmet commented 6 years ago

Hi @DmitrySkibitsky

Fixed. Update the package.