I use the following code to get data from two related tables:
$arr = []; $objectModel = new ProductCategory(); $objectModel::$language = 2; $subcategories =
You can use Laravel Collections https://laravel.com/docs/5.3/collections
Collections
$arr = ProductCategory::with("translate", "parent")->get() ->mapWithKeys(function ($item, $key) { return [$item->translate()->first()->objectId => $item->translate()->first()->name]; }) ->all();