src/Serverfireteam/Panel/libs/dashboard.php
public function create (AppHelper $appHelper, LinkRepository $linkRepository)
    {
        // @TODO cache

        return $linkRepository->all()

            ->filter(function ($link) {
                return $this->showLink($link);
            })

            ->map(function ($link) use ($appHelper) {

                $modelName = $link['url'];

                $model = $appHelper->getModel($modelName);

                return [
                    'modelName'   => $modelName,
                    'title'       => $link['display'],
                    'count'       => $model::count(),
                    'showListUrl' => 'panel/' . $modelName . '/all',
                    'addUrl'      => 'panel/' . $modelName . '/edit',
                ];
            })

            ->toArray();
    }
public function create (AppHelper $appHelper, LinkRepository $linkRepository)
    {
        // @TODO cache

        return $linkRepository->all()

            ->filter(function ($link) {
                return $this->showLink($link);
            })

            ->map(function ($link) use ($appHelper) {

                $modelName = $link['url'];

                $model = $appHelper->getModel($modelName);

                return [
                    'modelName'   => $modelName,
                    'title'       => $link['display'],
                    'count'       => $model::count(),
                    'showListUrl' => 'panel/' . $modelName . '/all',
                    'addUrl'      => 'panel/' . $modelName . '/edit',
                ];
            })

            ->toArray();
    }
public function create ( AppHelper $ appHelper , LinkRepository $ linkRepository ) { // @TODO cache return $ linkRepository -> all ( ) -> filter ( function ( $ link ) { return $ this -> showLink ( $ link ) ; } ) -> map ( function ( $ link ) use ( $ appHelper ) { $ modelName = $ link [ 'url' ] ; $ model = $ appHelper -> getModel ( $ modelName ) ; return [ 'modelName' => $ modelName , 'title' => $ link [ 'display' ] , 'count' => $ model :: count ( ) , 'showListUrl' => 'panel/' . $ modelName . '/all' , 'addUrl' => 'panel/' . $ modelName . '/edit' , ] ; } ) -> toArray ( ) ; }
Return the array of entity types (models / links)
to show CRUD interfaces for in the panel

@param AppHelper      $appHelper
@param LinkRepository $linkRepository

@return array
Return the array of entity types ( models / links ) to show CRUD interfaces for in the panel