dimanche 12 septembre 2021

message: Call to undefined method Illuminate\Contracts\Validation\Rule::unique()

I'm trying to validate fields in my form and using unique rule

 $validator = Validator::make($request->all(),[
    'email' => ['required', 'string', 'email', 'max:255', Rule::unique('users')->where(function ($q) {
   $q->whereNotNull('password');
}) ],
    'password' => ['required', 'string', 'min:5', 'confirmed','min:8'],
    'password_confirmation' => ['min:8']
]);

getting this error :

message: "Call to undefined method Illuminate\Contracts\Validation\Rule::unique()",

used this namespace :

use Illuminate\Contracts\Validation\Rule;

Any suggestion please, Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire