mardi 10 septembre 2019

Writing to Laravel application session from within a Laravel package

Laravel 5.8

I'm trying to write session data from within my Laravel package to the application but it doesn't appear to be saving correctly.

I've made sure all routes have 'web' middleware enabled:

Route::namespace('CompanyName\CMS\Http\Controllers')->middleware(['web'])->prefix('Admin')->name('admin.')->group(function () {

But when pushing to the session with

 session()->push('cropList', $item);

The session data is showing as empty.

From within my package service provider I have tried registering the session middleware:

   $this->app['router']->aliasMiddleware('StartSession', StartSession::class);
   $this->app['router']->aliasMiddleware('ShareErrorsFromSession', ShareErrorsFromSession::class);

Which doesn't seem to have any effect

This was working correctly when it was not running as a package



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NTL07C
via IFTTT

Aucun commentaire:

Enregistrer un commentaire