src/Widgets/ReportWidget.php
public function getReport(array $options = []) : array
    {
        if (empty($options['entity'])) {
            return [];
        }

        if (empty($options['reports'])) {
            $options['reports'] = $this->getReports();
        }

        $widgetId = $options['entity']->widget_id;

        if (empty($options['reports'])) {
            return [];
        }

        $result = [];
        foreach ($options['reports'] as $modelName => $reports) {
            foreach ($reports as $slug => $reportInfo) {
                if ($reportInfo['id'] !== $widgetId) {
                    continue;
                }

                $result = ['modelName' => $modelName, 'slug' => $slug, 'info' => $reportInfo];
            }
        }

        return $result;
    }
public function getReport(array $options = []) : array
    {
        if (empty($options['entity'])) {
            return [];
        }

        if (empty($options['reports'])) {
            $options['reports'] = $this->getReports();
        }

        $widgetId = $options['entity']->widget_id;

        if (empty($options['reports'])) {
            return [];
        }

        $result = [];
        foreach ($options['reports'] as $modelName => $reports) {
            foreach ($reports as $slug => $reportInfo) {
                if ($reportInfo['id'] !== $widgetId) {
                    continue;
                }

                $result = ['modelName' => $modelName, 'slug' => $slug, 'info' => $reportInfo];
            }
        }

        return $result;
    }
public function getReport ( array $ options = [ ] ) : array { if ( empty ( $ options [ 'entity' ] ) ) { return [ ] ; } if ( empty ( $ options [ 'reports' ] ) ) { $ options [ 'reports' ] = $ this -> getReports ( ) ; } $ widgetId = $ options [ 'entity' ] -> widget_id ; if ( empty ( $ options [ 'reports' ] ) ) { return [ ] ; } $ result = [ ] ; foreach ( $ options [ 'reports' ] as $ modelName => $ reports ) { foreach ( $ reports as $ slug => $ reportInfo ) { if ( $ reportInfo [ 'id' ] !== $ widgetId ) { continue ; } $ result = [ 'modelName' => $ modelName , 'slug' => $ slug , 'info' => $ reportInfo ] ; } } return $ result ; }
Parses the config of the report for widgetHandler

@param mixed[] $options with entity data.
@return mixed[]
Parses the config of the report for widgetHandler