laravel-nestedset
laravel-nestedset copied to clipboard
`withDepth()` return associative collection instead of indexed.
Model::withDepth()->get() returns associative collection where keys are strings with numbers instead of indexed collection (like in Model::query()->get()).
Steps to reproduce:
-
Create new laravel application (in my case
laravel/frameworkversion is 8.40.0) -
Install laravel-nestedset (5.0.3)
-
Create test model:
class TestModel extends BaseModel
{
use NodeTrait;
}
-
Seed test models.
-
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
});