The problem of searching results and downloading under laravel.

the download page and the search page are the same page, and you need to download the search results as files.
now the search and download methods are written, but you don"t know how to pass the parameters of get when you download it. Or send the search results directly to the download method.
is similar to this feeling.
I don"t know how to do either way of thinking.

public function search(Request $request)
{
    $keywords = [];
    $searchResult = [DB]
    return $searchResult;
}

public function download(Request $request)
{
     //1.
     $data = $searchResult;
     //2.get
    
    return CSV::download($data, $header, $filename, true);

}
Apr.29,2022

change the search method slightly.

  

resolved.
using cache, you can temporarily save the results and then take them out in the next method.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb0902-22ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb0902-22ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?