urameshibr / lumen-form-request

Laravel Form Request adaptation for Lumen framework
3 stars 1 forks source link

There is currently no session available. Lumen 9 #11

Closed jadsgithub closed 2 years ago

jadsgithub commented 2 years ago

Using the package on lumen 9 is returning the following error:

`[2022-02-25 14:46:32] local.ERROR: There is currently no session available. {"exception":"[object] (Symfony\Component\HttpFoundation\Exception\SessionNotFoundException(code: 0): There is currently no session available. at /var/www/html/vendor/illuminate/http/Request.php:513) [stacktrace]

0 /var/www/html/vendor/urameshibr/lumen-form-request/src/Providers/FormRequestServiceProvider.php(53): Illuminate\Http\Request->getSession()

1 /var/www/html/vendor/urameshibr/lumen-form-request/src/Providers/FormRequestServiceProvider.php(33): Urameshibr\Providers\FormRequestServiceProvider->initializeRequest()

2 /var/www/html/vendor/illuminate/container/Container.php(1265): Urameshibr\Providers\FormRequestServiceProvider->Urameshibr\Providers\{closure}()

3 /var/www/html/vendor/illuminate/container/Container.php(1212): Illuminate\Container\Container->fireCallbackArray()

4 /var/www/html/vendor/illuminate/container/Container.php(778): Illuminate\Container\Container->fireResolvingCallbacks()

5 /var/www/html/vendor/illuminate/container/Container.php(694): Illuminate\Container\Container->resolve()

6 /var/www/html/vendor/laravel/lumen-framework/src/Application.php(300): Illuminate\Container\Container->make()

7 /var/www/html/vendor/illuminate/container/BoundMethod.php(181): Laravel\Lumen\Application->make()

8 /var/www/html/vendor/illuminate/container/BoundMethod.php(124): Illuminate\Container\BoundMethod::addDependencyForCallParameter()

9 /var/www/html/vendor/illuminate/container/BoundMethod.php(36): Illuminate\Container\BoundMethod::getMethodDependencies()

10 /var/www/html/vendor/illuminate/container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()

11 /var/www/html/vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()

12 /var/www/html/vendor/illuminate/container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()

13 /var/www/html/vendor/illuminate/container/Container.php(653): Illuminate\Container\BoundMethod::call()

14 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(389): Illuminate\Container\Container->call()

15 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(355): Laravel\Lumen\Application->callControllerCallable()

16 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(329): Laravel\Lumen\Application->callLumenController()

17 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(282): Laravel\Lumen\Application->callControllerAction()

18 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(267): Laravel\Lumen\Application->callActionOnArrayBasedRoute()

19 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(169): Laravel\Lumen\Application->handleFoundRoute()

20 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(429): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()

21 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(175): Laravel\Lumen\Application->sendThroughPipeline()

22 /var/www/html/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(112): Laravel\Lumen\Application->dispatch()

23 /var/www/html/public/index.php(28): Laravel\Lumen\Application->run()

24 {main}

"} ` My config.

`namespace App\Http\Requests;

use Urameshibr\Requests\FormRequest;

class StoreUpdateServiceNow extends FormRequest { public function authorize() { return true; }

public function rules()
{
    return [
        'company_id' => 'required|string', 
        'mtr_id' => 'required|string',
        'cnpj' => 'required|string|min:14|max:14',
        'section' => 'required|string',
        'month' => 'required',
        'year' => 'required',
        'generation' => 'required',
    ];
}

}`

My use.

public function store(StoreUpdateServiceNow $request) { Code... }

rafapaulin commented 2 years ago

@jadsgithub seems that this repo is abandoned... found a replacement?

urameshibr commented 2 years ago

@jadsgithub @rafapaulin

I'm doing a fix.

urameshibr commented 2 years ago

I did solve the issue, thanks for the report.

Please, read the new README file. You must to use the current version 1.6.1.