Skip to content

Instantly share code, notes, and snippets.

@stevenwoodson
Created March 16, 2014 03:19
Show Gist options
  • Save stevenwoodson/9578083 to your computer and use it in GitHub Desktop.
Save stevenwoodson/9578083 to your computer and use it in GitHub Desktop.
Laravel 4 Custom Validation Rule - Date not today
// Return an error if $value day is today
Validator::extend('before_today', function($attribute, $value, $parameters) {
if ( strtotime( $value ) >= strtotime( date("Y-m-d") ) ) {
return false;
}
return true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment