ryangjchandler / orbit

A flat-file database driver for Eloquent. 🗄
MIT License
872 stars 39 forks source link

Connection Error on Validation rule "unique" #144

Closed ahosker closed 2 years ago

ahosker commented 2 years ago

If there is no existing rows in a table. The validation method "unique" does not work, presumably as the table does not exist?

The error is:

SQLSTATE[HY000] [2002] Connection refused

The desired outcome would be to pass the validation rule, as the email does not exist.

This does not work:

        $this->validate([
            'name' => ['required'],
            'email' => ['required', 'email', 'unique:users'],
            'password' => ['required', 'min:8', 'same:passwordConfirmation'],
        ]);

This works:

        $this->validate([
            'name' => ['required'],
            'email' => ['required', 'email'],
            'password' => ['required', 'min:8', 'same:passwordConfirmation'],
        ]);

You can re-create it with a blank Laravel Breeze project and just add Orbital to users model.

I have no idea where to look to propose a fix for this.

ryangjchandler commented 2 years ago

@ahosker Please look at the README. It states that you must points the unique rules and exists rules to the Orbit database, or use the model name instead.