Support the ongoing development of Laravel.io →
Requests Forms Validation
Last updated 2 years ago.
0

are you validating during a store or an update? if you're validating during a store, the created_at value is not being passed as a form variable. you can add it as hidden form field then this "should" work

'expected_at' => 'date|after:created_at',

if it's during an update, you need to get the record to check against.

$opportunity= Opportunity::find($id);

$rules['expected_at'] = 'date|after:'.$opportunity->created_at;

then that "should" work. according to docs

 The dates will be passed into the PHP strtotime function.

so it should support datetime format.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.