set unique value validation for laravel form request

48

set unique value validation for laravel form request -

use Illuminate\Validation\Rule;

public function rules()
{
    return [
	    'title' => [
		    'required',
		    Rule::unique('posts', 'title')->ignore($this->post)
	    ]
    ]; 
}

Comments

Submit
0 Comments