I have the following query:
$query = UserSubject::where('user_id', Auth::id())->select('subject_id')->get();
and as expected I get the following result:
Is there a way of copying the above result into another table so that my table looks like this?
1 |8 |9
2 |8 |2
The problem I have is that the $query can expect any number of rows and so im unsure how to iterate through an unknown number of rows.