Commit 24c1632
authored
Fix PostgreSQL bug when creating new admins (#135)
* Fix PostgreSQL bug when creating new admins
When creating a new admin the value of `request('admin.id')` is `NULL`, which means the email validation rule becomes `"required|email|max:255|unique:admins,email,"`.
This results in the SQL `select count(*) as aggregate from "admins" where "email" = 'test@example.com' and "id" <> ''`, which causes an exception in PostgreSQL: `SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: ""`.
This change first checks that `request('admin.id')` is not `NULL` before adding it to the email uniqueness check.
Fixes #86 and fixes #114
* Fix linting issues1 parent 4642010 commit 24c1632
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | | - | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
0 commit comments