<commit_before><?php

if (! function_exists('query_restorer')) {
    /**
     * Will store the current query, if there is no query it will look up in cookies and redirect if found.
     * @author <EMAIL>
     * @param array $params
     * @return bool|string
     */
    function query_restorer($params = [], $blacklist = [])
    {

        // Store and return
        if (! empty(\Request::all())) {
            \Cookie::queue(\Cookie::make(md5(\Request::url().'?'.http_build_query($params)), \Request::all(), 5));

            return false;
        }

        // Retrieve
        $query = \Cookie::get(md5(\Request::url().'?'.http_build_query($params)));

        foreach ($blacklist as $key) {
            unset($query[$key]);
        }

        // Redirect with queries
        if (! empty($query) && is_array($query)) {
            return \Request::url().'?'.http_build_query($query);
        }

        return false;
    }
}<commit_msg>added a new global function helper, which will return queries with flashes<commit_after><?php

use Nodes\Backend\Support\FlashRestorer;

if (!function_exists('query_restorer')) {
    /**
     * Will store the current query, if there is no query it will look up in cookies and redirect if found.
     *
     * @author <EMAIL>
     * @param array $params
     * @return bool|string
     */
    function query_restorer($params = [], $blacklist = [])
    {

        // Store and return
        if (!empty(\Request::all())) {
            \Cookie::queue(\Cookie::make(md5(\Request::url() . '?' . http_build_query($params)), \Request::all(), 5));

            return false;
        }

        // Retrieve
        $query = \Cookie::get(md5(\Request::url() . '?' . http_build_query($params)));

        foreach ($blacklist as $key) {
            unset($query[$key]);
        }

        // Redirect with queries
        if (!empty($query) && is_array($query)) {
            return \Request::url() . '?' . http_build_query($query);
        }

        return false;
    }
}

if (!function_exists('query_restorer_with_flash')) {
    /**
     * Will restore the origin url with queries, but also remember the session flashes
     *
     * @author <NAME> <<EMAIL>>
     * @access public
     * @param array $params
     * @param array $blacklist
     * @return bool|\Illuminate\Http\RedirectResponse
     */
    function query_restorer_with_flash($params = [], $blacklist = [])
    {

        if ($redirect = query_restorer($params, $blacklist)) {
            $redirectResponse = redirect()->to($redirect);

            (new FlashRestorer())->apply($redirectResponse);

            return $redirectResponse;
        }

        return false;
    }
}
{'fraction_non_alphanumeric': 0.1547663551401869, 'fraction_numerical': 0.0022429906542056075, 'mean_word_length': 2.283435582822086, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2217387', 'n_tokens_mistral': 774, 'n_tokens_neox': 758, 'n_words': 181}