Ad
¿How To Create A Custom FormRequest From Normal Request?
I find something lost...
The problem
I need to construct 2 custom FormRequest from 1 normal Request Let's suppose this fake scenario
First FormRequest
StoreClientRequest
Second FormRequest
UpdateClientRequest
On the Controller:
public function store(Request $request){
//Do something...
$firstRequest = new StoreClientRequest($request);
$secondRequest = new UpdateClientRequest($request);
}
Are there way to make something similar to this fake scenario.
Ad
Answer
If you really want to get an instance of your Form Requests, without resolving them from the IoC Container, you could use the createFrom
method:
$firstRequest = StoreClientRequest::createFrom($request);
This will make sure it is filled with the same data as $request
.
Ad
source: stackoverflow.com
Related Questions
- → "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