I have the MyRequest class, which contain validation rules for request params. In the "file" field can be null or string or file. How I can build the rule conditions for it?
class MyRequest extends FormRequest
// ...
public function rules()
{
return [
// 'file' => 'image|max:20480', // need to combine this
// 'file' => 'nullable|string', // and this through OR
// 'file' => 'nullable|string|image|max:20480' // <- don't working (string not pass validation)
];
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire