$rules = array(
'url' => 'required|unique:products,url,{{$id}}',
);
public function validate($data, $id = null)
{
$rules = $this->rules;
foreach($rules as $keys => $value) {
$validations = explode('|', $value);
foreach($validations as $key => $value) {
$validations[$key] = str_replace('{{$id}}', $id, $value);
}
$implode = implode("|", $validations);
$rules[$keys] = $implode;
}
return \Validator::make($data, $rules);
}