i am building a laravel aplication and i have this line of code which should redirect the user back to form he just submited , with the old input and the result of some operations .
return back()->with(["result" => round($area, 2)])->withInput($request->all());
The problem is that i only receive the old input in blade and the $result
variable is not available in the view.
This is how i try to output the result:
<input type="text" name="result" value="{{isset($result)&&old('roofType')==0?$result:''}} ㎡ " class="form-control input-sm" >
And here is what variables i have in the view after submit:
{{ dd(get_defined_vars()['__data']) }}:
array:7 [▼
"__env" => Factory {#89 ▶}
"app" => Application {#3 ▶}
"errors" => ViewErrorBag {#169 ▶}
"roofName" => "Acoperis intr-o apa"
"roofType" => "1"
"roofFolder" => "A1"
"baseFields" => array:3 [▼
0 => "L"
1 => "l"
2 => "H"
]
]
session
only. – Fixing