table = $table; $this->id = $id; } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value): bool { return DB::table($this->table) ->where($this->id, $value) ->doesntExist(); } /** * Get the validation error message. */ public function message(): string { return 'Item already exists'; } }