Reputation: 703
I have an issue in my laravel app.
I want to sent an array to another route.
here is the code. Controller:
$emparray =[
'fname'=>Input::get('efname'),
'lname'=>Input::get('elname'),
'dob'=>Input::get('edob'),
'reg_date'=>date('Y-m-d'),
'email'=>Input::get('eemailaddrs'),
'gender'=>Input::get('gender'),
'mobile'=>Input::get('emobile'),
'p_addrss'=>Input::get('epaddress'),
'c_addrss'=>Input::get('ecaddress'),
'quals'=>Input::get('quali'),
'pdfname'=>$pdfname,
];
return Redirect::to('print-view',$emparray);
Routes.php
Route::get('print-view/{$emparray}', array('as'=>'print-view','uses'=>'EmployeeController@PrintView'));
Final Controller.
public function PrintView($emparray)
{
return $emparray;
}
I Can't get the successful output. Is there any issues with my code.?
Getting error like "The HTTP status code "1" is not valid." Thanks..
Upvotes: 2
Views: 540
Reputation: 345
Why don't you call the PrintView method directly? I mean... why do you need to route all this data?
Upvotes: 0
Reputation: 1959
You cant do it like this ,if you would check the to
method you would see this -
public function to($path, $status = 302, $headers = [], $secure = null)
{
$path = $this->generator->to($path, [], $secure);
return $this->createRedirect($path, $status, $headers);
}
so basically you send the status
parameter an array. to send parameters you will need to use the action
/route
methods
Upvotes: 0