Level 2
I found a workaround using:
foreach (request()->except('_token') as $key => $value) {
\Session::put('companydetails.'.$key, $value);
}
But there must be an easier way - or??
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I have an array 'companydetails' with some values in it stored in my session.
I want to add all request inputs using:
\Session::push('companydetails', request()->all());
but this adds a new array to the existing one.
Here's the output:
"companydetails" => array:7 [▼
"name" => "test 123"
"address" => "addr 123"
"zip" => "1010"
"city" => "v"
"phone" => "12341234"
"title" => null
0 => array:1 [▼
"submit_county" => "1"
]
]
I want to add the "submit_county" value to the companydetails without the [0]
Thanks for help!
Please or to participate in this conversation.