Skip to content

Instantly share code, notes, and snippets.

@mergeweb
Last active May 11, 2016 13:36
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 mergeweb/36665e7a9b2bf918b5e4835cb2d9813c to your computer and use it in GitHub Desktop.
Save mergeweb/36665e7a9b2bf918b5e4835cb2d9813c to your computer and use it in GitHub Desktop.
<?php
$fields = [
'title' => 'Your listing needs a title',
'insurer_id' => 'Please specify an Insurer'
];
$rules = [];
foreach($fields as $field => $message){
$rules['location_' . $field] = [
'rule' => 'validateNotEmpty',
'on' => [$this, 'onNotDraftStatus'],
'pass' => [$field],
'message' => $message
];
}
return $rules;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment