you could put it in the form request under the authorize section
public function authorize()
{
if ($this->request->has('image-name')) {
$image = $this->request->get('image-name');
if ($image->width < $image->height) {
session()->flash('error', 'Image must be horizontal!');
return false;
}
}
// the above either wasn't required, or passed
return true;
}
public function forbiddenResponse()
{
return $this->redirector->to($this->getRedirectUrl())
->withInput($this->except($this->dontFlash));
}
You could also leave out the forbidden response message part, but on my sites I check for error or success in the session and have a flash banner.
https://mattstauffer.co/blog/laravel-5.0-form-requests#4.-create-your-formrequest