Comments (5)
Hi. Thats because youre loading children each time in a loop by invoking
relation method children() rather than using filled value. Change
children()->get() to children
from laravel-nestedset.
Thanks for a quick reply.
This only returns an empty collection on page with children.
from laravel-nestedset.
Get descendands of the page (this includes children and children of children, etc) and convert results to a tree:
$pages = $page->getDescendands()->toTree();
@unless($page->children->isEmpty())
@foreach ($page->children as $child)
@endforeach
@endunless
from laravel-nestedset.
Sorry but I just can't get this to work properly...
public function index(Page $page) //all pages
{
$pages = $page->getDescendants()->linkNodes();
return view('admin.pages.index', compact('pages'));
}
throws ErrorException in QueryBuilder.php line 150: Undefined offset: 0
I also get this warning from time to time
Maximum function nesting level of '100' reached, aborting!
from laravel-nestedset.
Sorry, man, I can't do it for you! You have a huge whitespace in understanding how both laravel and nestedsets work, please refer to the docs.
But, anyway, error in query builder just indicates that $page
doesn't exists.
from laravel-nestedset.
Related Issues (20)
- Integrity constraint violation error when deleting a node. HOT 1
- How to Move Between Root
- Use fully qualified key on QueryBuilder
- Problem with deadlock and broken tree when performing new registrations.
- My workaround to rebuildTree().
- My node has no parent, but has ancestors HOT 3
- Laravel 10 support HOT 4
- How to restrict descendants by status? HOT 1
- Efficiently restrict number of levels when using descendants()
- Is it possible to move QueryBuilder logic to trait? To support custom Builders
- You May Ordered Children with adding this method.
- Code runs in SQL error for height = 0 in QueryBuilder::columnPatch(...)
- fix parent function name
- Binary Tree Function
- finding siblings and parents
- Parent _lft and _rgt not updated after adding child using `create()` method HOT 2
- Sibling of the same category will be move as per id or record list. HOT 1
- Undefined method `append`
- Laravel 11 HOT 1
- Problem to require in Laravel 11 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-nestedset.