2 weeks agoby Matthias Alfers

Getting it the eloquent way... but how?


i want to know how i can setup my table design and it's relation. My problem is how to get the Session table connected to the software table. The session table is a simple import of a CSV file and the installer_version will look like 14.6.100,, 19.5 etc. The same is stored in software installer_version to translate the installer_version to something like: SoftwareName Windows 4.6 . So, how can i set this into eloquent relations? Any idea?

The following tables are given:

Report: id user_id title slug

Software: id name platform version installer_version

Session: id report_id installer_version


Matthias Alfers replied 2 weeks ago


Thanks for coming back to me, with your suggestion.

I thought like this:

The table Session will be just filled by importing a CSV with one Column. This Installer_version value is equal to a value in Software table. Adding a field software_id as foreign key to the session table, this has to be filled during the import of the CSV file while checking after every imported row, installer_version against software table installer_version and if matching, get the id of software and put it into sessions table software_id.


Sarthak replied 2 weeks ago


You can put a field on your session table or on software table for connection between them.

First think about what kind of relation they have and then add column accordingly.

Is it a one to many, one to one, many to many etc, decide this first.

Ask Question
Most Visited