Collection selection

This is the official documentation of the forestadmin/laravel-forestadmin v2+ and forestadmin/symfony-forestadmin PHP agents.

You may not want to import all collections from a data source.

This can be achieved by providing a whitelist or a blacklist in the options of the agent.addDataSource method.

use ForestAdmin\AgentPHP\Agent\Utils\Env;
use ForestAdmin\AgentPHP\DatasourceDoctrine\DoctrineDatasource;
use ForestAdmin\SymfonyForestAdmin\Service\ForestAgent;

return static function (ForestAgent $forestAgent) {

    $forestAgent->addDatasource(
        new DoctrineDatasource(
            $forestAgent->getEntityManager(),
            [
                'url' => Env::get('DATABASE_URL'),
            ]
        ),
        [
            'include' => ['Book', 'Review'],
            // You can also exclude
            'exclude' => ['Author', ...]
        ]
    )
        ->build();
};

Last updated