Closed pqr closed 3 years ago
Hey @pqr! I updated this. This should work now:
public function rules(Model $model): array
{
return [
'slug' => [
'required',
Rule::unique(self::$model, 'slug')->ignore($model),
],
];
}
https://user-images.githubusercontent.com/5102591/103000702-9714a900-453c-11eb-95cf-b0c9b103f047.mp4
Confirm, works now!
According to documentation rules method accepts
$model
but
rules()
definition does not: https://github.com/orchidsoftware/crud/blob/master/src/Resource.php#L225As a result I get an error when trying to define a
rules()
method with$model
parameter: