had to use first instead of get.
$leverancier = DB::table('leveranciers')
->where('leveranciersId', '=', $id)
->join('plaatsen', 'leveranciers.plaatsId', '=', 'plaatsen.plaatsId')
->first();
I recommend using the join clause before the where clause
Also, if you have a one to many relationship, you should use get instead of first.
$leverancier = DB::table('leveranciers')
->where('leveranciersId', '=', $id)
->join('plaatsen', 'leveranciers.plaatsId', '=', 'plaatsen.plaatsId')
->get([
'leveranciers.field1 AS f1',
'leveranciers.field2 AS f2,
'plaatsen.field1 AS f3,
'plaatsen.field2 AS f4'
])
->first();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community