Use Laravel's excellent FormRequest as Singleton.
lextira/laravel-formrequest-singleton is a Laravel package for use laravel's excellent formrequest as singleton..
It currently has 2 GitHub stars and 4.225 downloads on Packagist (latest version v1.1.0).
Install it with composer require lextira/laravel-formrequest-singleton.
Discover more Laravel packages by lextira
or browse all Laravel packages to compare alternatives.
Last updated
Use Laravel's excellent FormRequest as Scoped
composer require lextira/laravel-formrequest-singletonconfig/app.php in your projectIlluminate\Foundation\Providers\FoundationServiceProvider::classLextira\FormRequestSingleton\FoundationServiceProvider::classAll classes, which extend Illuminate\Foundation\Http\FormRequest are now instantiated as scoped.
This brings the following benefits:
prepareForValidation() are applied only once,
even if the FormRequest is used multiple times.