I have table orders which has column files. The column holds file id's and they are comma separated.
Second table is documents.
Table Name : orders
orders_id | order_details | file_id
------------------------------------
1 | some details | 1,2
Table Name : documents
id | name
------------------
1 | file name
2 | file2 name2
Currently I have this query which query only orders table but I want to join documents also so I can show to customer the names of documents which are connected in file_id column in orders
$docomuntOrders = Order::where('user_id',getCurrentUser()->user_id)
->orderBy('order_id', 'DESC')
->paginate(10);
Can you guide a little bit here?
order_idin the documents table to define relationship If it's is in development phase. Other wisejsoncan be another good optiondocumentsis separated table. When I upload documents via admin panel is stored there. I don't knoworder_idand I should not need to know it. I'm not sure I understand you.array_mapto get file_id of one column but with all it will be difficult to get.