Desired Output is like :
Parent Cat 1
Parent Cat 2
Child Cat 1
Child Cat 2
Parent Cat 3
Child Cat 3
but i need to do like this while the table structure is like below
id | cat_name | cat_parent_id
--- | --------------| -------------
1 | Parent Cat 1 | NULL
2 | Parent Cat 2 | NULL
3 | Child Cat 1 | 2
4 | Child Cat 2 | 2
5 | Parent Cat 3 | NULL
6 | Child Cat 3 | 5
Table structure was like this
I would like to get the output like below in blade view:
Laravel view in table for all parents:
Parent Cat 1
Parent Cat 2
Parent Cat 3
Laravel view in table for all childs:
Child Cat 1
Child Cat 2
Child Cat 3
How get Like this on an above strucutre based on all the parents