Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tinkerbell's avatar

Is there a way to create an organization CRUD tree (OrgChart) with Laravel

I have the following tables

'usertree'
parentid  |  Child id |  type

'parentid' and 'child id' are the 'users id' based on the 'user.type' admin, teacher,manager,student.
are connected toghther

type 1,2,3,4  |   parentid  |  Child id |
.......................................................................
if type = 1 : admin to manager connection
if type = 2 : manager to teacher connection
if type = 3 : teacher to teacher connection
if type = 4 : teacher to student connection


'user table'
name  |  email | type  |   phone num 
where
 'user.type' admin, teacher,manager,student.

I want to create a tree for the usertree table based on the type condition in the usertree when admin can see the entire connection and do CRUD on them.

can anyone show me a way to do that? or a package in laravel?

what I want to implement is something like that

https://imgur.com/a/ZxsXmcm

0 likes
4 replies
vincent15000's avatar

Hello,

I think it's not a Laravel problem.

You have to write a some queries to retrieve the good informations and then you have to use a library like GD to draw your chart.

V

1 like
tinkerbell's avatar

Thank u for ur comment @vincent15000 may I ask what is GD??

What i want to achieve is having a crud inside the tree not a simple drawing!!

vincent15000's avatar

Ok I didn't understand that.

So I would better do something else that a simple drawing with GD (GD is a library to draw lines, circles, ...).

You could for example use simple div tags in which you write the name of the persons and organize your div like a tree with CSS.

And then you can add a click event on each div to get the CRUD functionality.

Please or to participate in this conversation.