Skip to content

Instantly share code, notes, and snippets.

@beeblebrox3
Created December 14, 2014 20:32
Show Gist options
  • Save beeblebrox3/ca5b7e124b8268f1e9cd to your computer and use it in GitHub Desktop.
Save beeblebrox3/ca5b7e124b8268f1e9cd to your computer and use it in GitHub Desktop.
updateUniques
<?php
protected function updateUniques(array $rules, Eloquent $model)
{
foreach ($rules as $field => $rule) {
$rules[$field] = preg_replace(
"/unique\:([a-z_]+)/i", 'unique:$1,' . $field . ',' . $model->id, $rule
);
}
return $rules;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment