Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Crudit Bundle Laravel Package

2lenet/crudit-bundle

Symfony bundle to rapidly build configurable CRUD back offices with SB Admin layout. Provides list views with pagination, sorting, actions, exports and batch ops, plus datasources, filters, menus, workflows, maps, markdown and Twig helpers.

View on GitHub
Deep Wiki
Context7

How to use a FilterSet in your own Controller

It is easily possible to apply the result of you filters within your own Controller.

If you want to learn how to create filters and your FilterSet, please read the chapter about filters.

1. Inject your FilterSet and the FilterState in your Controller

private SiteCollecteFilterset $filterset;
private FilterState $filterState;

public function __construct(
    SiteCollecteFilterset $filterset,
    FilterState $filterState
) {
    $this->filterset = $filterset;
    $this->filterState = $filterState;
}

2. Then, in your method, create your initial queryBuilder

In the method:

  $qb = $this->siteCollecteRepository->findSiteCollecteWithGeoQb();

In the repository:

public function findSiteCollecteWithGeoQb()
{
    return $this->createQueryBuilder('root')
        ->andWhere('root.centreLat IS NOT NULL AND root.centreLng IS NOT NULL OR root.polygone IS NOT NULL')
        ;
}

3. In your method you can now retrieve your filters, apply your query to them and run the whole thing

$qb = $this->siteCollecteRepository->findSiteCollecteWithGeoQb();

foreach ($this->filterset->getFilters() as $filter) {
    $filter->setData($this->filterState->getData($this->filterset->getId(), $filter->getId()));
    $filter->apply($qb);
}

$sitesCollectes = $qb->getQuery()->execute();

Tadaaaa, the sitesCollectes take into account both your query in the repository and what you have passed in your filters.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
bugban/php-sdk
littlerocket/job-queue-bundle
graham-campbell/flysystem
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
directorytree/opensearch-client
directorytree/opensearch-adapter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php