If I understand the question, then the answer is, Yes.
Query Builder: multiple joins based on array
Hi everyone,
according to the official documentation I have to write something like this when I want to join multiple tables:
$items = DB::table ( $table ) -> leftJoin ($jointable1', $key1, '=', $joinkey1) -> leftJoin ($jointable2', $key2, '=', $joinkey2) -> leftJoin ($jointable3', $key3, '=', $joinkey3) -> leftJoin ($jointable4', $key4, '=', $joinkey4)
Is it also possible to add the joins by iterating over an array like in ->select () or ->where ()? This would be quite handy if I want to create a query based on a configuration file or something like that. Right now I have to write the query and the joins over and over again when I need them in multiple places.
Please or to participate in this conversation.