Dear developers! Tell me how to use laravel 5.4 to make a one-to-many relationship in ONE table. I want to display a menu with unlimited nesting. There is a table of catalogs ('id', 'title', 'parent'), where parent is the id of the parent. I read about the hasMany documentation with two tables, tried to do the same with one - did not work out. I liked the solution for this link: https: / /www.sitepoint.com/laravel-blade-recursive-partials/ but I don’t know how to bring this data into this structure so that there is an array across the childrens field, for example. Perhaps there is a solution here, as in the C # entity framework code first, there I indicated the data type simply and the framework automatically created the connection. Another question is, if anyone knows: and if I make a one-to-many connection to phpmyadmin with my hands, do not have to write hasMany in laravel?

In laravel novice, I will be grateful for any help!

  • hasMany to self prescribe. And to work with trees, look towards the nested set - if large trees are very convenient. Package for laurer baum called. - Boris
  • in Laravel need to register communication. without this, Eloquent will not see the connection - Hovo
  • This is in two words a newcomer can not be said. but look here! youtube.com/watch?v=mN15LtMy38I - user-name

0