I'd like to know if it is possible to do a left join in a query and if it exists instead of having all the columns in the same "level" make the joined table go as a property (This without any relationships)
For example
$users = user::leftJoin("posts","users.id","=","posts.user_id")->get();
Instead of returning every field together,
["id"/*This actually gets messed up if select doesn't choose wich to use*/,
"name",
"age",
/*Now post fields*/
"tile",
"date_posted"
...
]
and having it return
["id",
"name",
"age",
"post"=>[
"id",
"tile",
"date_posted"
...
]
]
Edit: If possible to avoid loops for obvious reasons... I know it is possible and in last resort will use them but not using loops would help out alot