Skip to content

Instantly share code, notes, and snippets.

@mdmunir
Last active August 29, 2015 14:12
Show Gist options
  • Save mdmunir/e09be533a4072be3a257 to your computer and use it in GitHub Desktop.
Save mdmunir/e09be533a4072be3a257 to your computer and use it in GitHub Desktop.
<?php
$model->addRule(['name', 'body'], 'required')
->addRule(['name'],function()use($model){
if(count(array_unique($model->name)) != count($model->name){
$model->addError('name','Name harus unik');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment