public function getByCategories()
    {
        $data = [
            'categories' => $this->getCategories(),
            'settings' => [],
        ];

        foreach ($data['categories'] as $key => $category) {
            $model = self::find()
                ->where(['category' => $category])
                ->indexBy('id')
                ->all();
            $data['settings'][$category] = $model;
        }

        return $data;
    }
public function getByCategories()
    {
        $data = [
            'categories' => $this->getCategories(),
            'settings' => [],
        ];

        foreach ($data['categories'] as $key => $category) {
            $model = self::find()
                ->where(['category' => $category])
                ->indexBy('id')
                ->all();
            $data['settings'][$category] = $model;
        }

        return $data;
    }
public function getByCategories ( ) { $ data = [ 'categories' => $ this -> getCategories ( ) , 'settings' => [ ] , ] ; foreach ( $ data [ 'categories' ] as $ key => $ category ) { $ model = self :: find ( ) -> where ( [ 'category' => $ category ] ) -> indexBy ( 'id' ) -> all ( ) ; $ data [ 'settings' ] [ $ category ] = $ model ; } return $ data ; }
Returns settings grouped by categories
@return array
Returns settings grouped by categories