Pass an array to Redirect::action in laravel

浪尽此生 提交于 2019-12-06 15:51:43

You could maybe get it to work with passing by the URL by serialization, but I'd rather store it in a session variable. The session class has this nice method called flash which will keep the variable for the next request and then automatically remove it.

Also, and that's just a guess, you probably need to use the index action for that, since show needs the id of a specific resource.

public function search($code, $id){
    //some queries 
    $result = DB::table('abd')->get();
    Session::flash('search', $search); // or rather $result?
    return Redirect::action('PageController@index');
}

public function index($code){
    //some code
    if(Session::has('search')){
        $search = Session::get('search');
        dd($search);
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!