laravel-nestedset icon indicating copy to clipboard operation
laravel-nestedset copied to clipboard

`withDepth()` return associative collection instead of indexed.

Open rikipm opened this issue 4 years ago • 0 comments

Model::withDepth()->get() returns associative collection where keys are strings with numbers instead of indexed collection (like in Model::query()->get()).

Steps to reproduce:

  1. Create new laravel application (in my case laravel/framework version is 8.40.0)

  2. Install laravel-nestedset (5.0.3)

  3. Create test model:

class TestModel extends BaseModel
{
    use NodeTrait;
}
  1. Seed test models.

  2. Check what query with depth to this model will return:

Route::get('test', function () {
    $result = TestModel::query()->get();
    dd($result); // Integer keys
    
    $result = TestModel::withDepth()->get();
    dd($result); // String keys
});

rikipm avatar May 31 '21 19:05 rikipm