I have a table with more then 6,000 rows that i need to "get" as join to other table. I want this join to be as "second level" of the first level. There is any way to do it? (Not with eloquent, this make it very slow...)
for example:
$query = DB::table('first_table')
->join('second_table', 'first_table.id', '=', 'second_table.first_id')
->get();
What I get from this is:
[0] => [
[id] => 1
[info] => true
[first_id] => 1
[something] => 929
]
[1] => [
[id] => 2
[info] => true
[first_id] => 2
[something] => 1212
]
[2] => [
[id] => 3
[info] => true
[first_id] => 2
[something] => 4444
]
What I want to get is:
[0] => [
[id] => 1
[info] => true
[second_table] => [
[first_id] => 1
[something] => 929
]
]
[1] => [
[id] => 2
[info] => true
[second_table] => [
[first_id] => 2
[something] => 1212
]
]
[2] => [
[id] => 3
[info] => true
[second_table] => [
[first_id] => 2
[something] => 4444
]
]
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire