#No property found for validation [0]

16 messages · Page 1 of 1 (latest)

topaz trout
#

You can't just append a Rule object to a string. The validation rules of email into an array.

#

Oh just noticed its a comma not a dot. Just throw square brackets around the rules and you should be fine. 'email' => [ ... ]

balmy flume
dull cave
#
'email' => ['required', 'unique:users,email', Rule::unique('users')->ignore($this->user()->getKey()),
topaz trout
#

☝️

dull cave
#

@balmy flume And also, because a form request class extends the base Request class, you can just use $this->user to access the authenticated user rather than relying on facades or helpers like auth()->user()

balmy flume
#

it doesn't have access to it

topaz trout
#

Ah, you're calling it from a controller

balmy flume
balmy flume
topaz trout
#

Just use the auth() helper is fine

#

Best is to just extract your validation to a form request, to keep your code clean (and benefit of stuff like this), but thats upto you

echo mirage
balmy flume