Skip to content

Instantly share code, notes, and snippets.

@fhdalikhan
Last active December 4, 2020 15:49
Show Gist options
  • Save fhdalikhan/e1d7567fd0b9287db97589d4ce43d535 to your computer and use it in GitHub Desktop.
Save fhdalikhan/e1d7567fd0b9287db97589d4ce43d535 to your computer and use it in GitHub Desktop.
Different laravel validation rules
// mimetype mp4, max is in kilobytes
mimetypes:video/mp4|max:15000
// only images and max size of 500 KB
image|max:500
// exists checks the attribute value in a table exists, format is: {table},{column}
required|exists:projects,id
// mimetypes for documents like word, powerpoint, excel and pdf with max filesize of 5000 KB
mimes:doc,docx,ppt,pptx,xls,xlsx,pdf|max:5000
// image mimetypes allowed, max image dimensions specified in px
// Available constraints are: min_width, max_width, min_height, max_height, width, height, ratio.
image|nullable|dimensions:max_width=170,max_height=100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment