Support the ongoing development of Laravel.io →
Requests Input
Last updated 1 year ago.
0

One way of doing what you want to achieve is

public function store(StoreProductRequest $old_request){
    if ($old_request->type == 'MOVIE'){
    $request = new Requests\StoreMovieRequest;
    $this->validate($old_request, $request->rules());
    //validation passed for StoreMovieRequest
    }
    else {
    $request = new Requests\StoreSoftwareRequest;
    $this->validate($old_request, $request->rules());
    //validation passed for StoreSoftwareRequest
    }
}

Source: http://stackoverflow.com/questions/33504426/laravel-multiple-f...

0

Sign in to participate in this thread!

Eventy

Your banner here too?

noorxbyte noorxbyte Joined 27 Oct 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.