Lumen Request has session app('session') is empty. Redirect not working
Ad
When taking the following store method on a lumen controller
public function store(Request $request, JwtToken $jwtToken, Redirector $redirector)
{
$sessionData = $request->session()->all();
$this->validate($request, [
'username' => 'required',
'password' => 'required'
]);
}
In $sessionData all the data in the session is present including the previous url. When going through the default validator it calls app('session')->previousUrl()
which returns null
When doing the same on $request->session()
it is present. I have no clue if I messed something up or this is a bug in lumen.
I tried Redis and File driver.
Ad
Answer
Ad
Seems to be a bug in Lumen fixed by doing the following
public function store(Request $request, JwtToken $jwtToken)
{
$sessionData = $request->session()->all();
$this->validate($request, [
'username' => 'required',
'password' => 'required'
]);
//use global redirect helper function
}
Removed the Redirector reference and used the global helper function
Ad
source: stackoverflow.com
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad