I have the mutator as the example in https://backpackforlaravel.com/docs/5.x/crud-fields#image-pro
But I had trouble including the validation rules.
I tried with 'photo' => 'nullable|base64image|base64mimes:jpg|base64max:2048',
And it works when I upload a new image, but if I have an image and try to edit another field it flags the errors:
"The photo field must be an image."
"The photo field must be a file of type: jpg."
Does anyone have any idea why this is happening? or what is the correct way to validate with the pro image field?
2
Answers
namespace AppHttpControllers;
use AppHttpRequestsYourFormRequest;
use IlluminateHttpRequest;
class YourController extends Controller
{
public function store(YourFormRequest $request)
{
// The request is valid, proceed with storing the data or handling the file
// The uploaded file is available via $request->file(‘pro_image’)
}
i do this validation with custom validator extend, like this:
app/Providers/AppServiceProvider.php
app/Http/Requests/XYZRequest.php
Is working always.
Cheers