Skip to content

Instantly share code, notes, and snippets.

@mackhankins
Created July 14, 2016 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mackhankins/b81116d59baf2fb56013515ac3a2a5cd to your computer and use it in GitHub Desktop.
Save mackhankins/b81116d59baf2fb56013515ac3a2a5cd to your computer and use it in GitHub Desktop.
Begins With Custom Validator for Laravel
//Great for validating twitter / telegra usernames ('telegram' => 'begins_with:@')
$this->app['validator']->extend('begins_with', function($attribute, $value, $parameters, $validator) use ($zipCode) {
return $value[0] == $parameters[0];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment