public function get($plantID) { $colorsForPlant = PlantColor::where('plant_id', '=', $plantID)->get(); $colorArray = array(); $translatedColorArray = array(); foreach ($colorsForPlant as $color) { $colorArray[] = Colors::where('id', '=', $color['color_id'])->get()[0]['color']; } foreach ($colorArray as $color) { if (array_search($color, $this->translationsArray)) { $translatedColorArray[] = array_search($color, $this->translationsArray); } } return $translatedColorArray; }