M
M
movetonull2020-08-04 12:41:41
OctoberCMS
movetonull, 2020-08-04 12:41:41

How to export data from OctoberCMS with filters?

In the admin panel, I implemented a section for viewing applications, added various filters by parameters, now we need to add the ability to upload this list of applications, taking into account filters in csv.
The example from the documentation https://octobercms.com/docs/backend/import-export does not allow passing applied filters for export.

So, how to upload a list in the admin panel, taking into account the selected filters by the user?

5f292d11ca00e651294887.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
movetonull, 2020-08-06
@movetonull

Found a solution:

function getCurrentFilters()
{
    $filters = [];
    foreach (\Session::get('widget', []) as $name => $item) {
        if (str_contains($name, 'Filter')) {
            $filter = @unserialize(@base64_decode($item));
            if ($filter) {
                $filters[] = $filter;
            }
        }
    }

    return $filters;
}

source: https://octobercms.com/forum/post/how-get-list-fil...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question