mardi 1 décembre 2015

Use Form Request validation with related models

I'm using (and loving) the Laravel 5 form request validation so far. But now I'm stuck trying to validate related models.

Say I have a Car model which has many Wheel models and I'd like to validate a new car. In the CarController@store store method I'm using the following to validate the car, but this does of course not validate the wheels.

public function store(StoreCarRequest $request)
{
   // Create the car
}

What needs to be done to validate the Wheels of a Car? Can this be done with form request validation?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire