Bolt\Controller\Backend\General::getLatest PHP Method

getLatest() private method

When there are no Contenttype records we will suggest to create some dummy content.
private getLatest ( integer $limit = null ) : array
$limit integer
return array
    private function getLatest($limit = null)
    {
        $total = 0;
        $latest = [];
        $user = $this->users()->getCurrentUser();
        $permissions = [];
        $limit = $limit ?: $this->getOption('general/recordsperdashboardwidget');
        // Get the 'latest' from each of the content types.
        foreach ($this->getOption('contenttypes') as $key => $contenttype) {
            if ($this->isAllowed('contenttype:' . $key) && $contenttype['show_on_dashboard'] === true && $user !== null) {
                $latest[$key] = $this->getContent($key, ['limit' => $limit, 'order' => '-datechanged', 'hydrate' => false]);
                $permissions[$key] = $this->getContentTypeUserPermissions($contenttype, $user);
                if (!empty($latest[$key])) {
                    $total += count($latest[$key]);
                }
            }
        }
        return ['latest' => $latest, 'permissions' => $permissions, 'suggestloripsum' => $total === 0];
    }