Reputation: 117
The problem looks basic but it is really painful! I'm using get method and getting value in controller and I want the same value to return in another view. How can I do that??? Please help!!! This is my function from controller:
public function guest(){
if (Input::get('Cash On Delivery')){
$get = Input::get('Cash On Delivery');
return Redirect::to('guest/guestview/'.$get);
}
Upvotes: 1
Views: 594
Reputation: 17545
Well, with regards to your answer, using $_REQUEST
directly is not Laravel's way of doing things :(
I believe this is better
public function guest(Request $request)
{
if ($request->payment_method == ('Cash On Delivery'))
{
return view('guest/guestview', ['guest'=>$request->payment_method]);
}
}
Upvotes: 1
Reputation: 117
Ok Guys, I figured it out, Just do this below.
public function guest(Request $request){
if ($request->payment_method == ('Cash On Delivery')){
$get = $_REQUEST['payment_method'];
return view('guest/guestview', compact('get'));
}
Upvotes: 0