PHP code example of ghaliano / easyadmin-grouping-bundle
1. Go to this page and download the library: Download ghaliano/easyadmin-grouping-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ghaliano / easyadmin-grouping-bundle example snippets
use Ghaliano\EasyAdminGrouping\Application\GroupingConfig;
use Ghaliano\EasyAdminGrouping\Infrastructure\EasyAdmin\GroupableCrudControllerTrait;
use Ghaliano\EasyAdminGrouping\Infrastructure\EasyAdmin\GroupingActionHelper;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
class UserCrudController extends AbstractCrudController
{
use GroupableCrudControllerTrait;
public static function getEntityFqcn(): string
{
return User::class;
}
public function configureGrouping(): GroupingConfig
{
return GroupingConfig::create()
->groupByProperty('department.name', 'Department');
}
public function configureActions(Actions $actions): Actions
{
return $actions->add(
Action::INDEX,
GroupingActionHelper::groupedTableAction()
);
}
}