Calling model method like an attribute

In the following forum post, Qiang shows how you can use a virtual attribute to convert a date format to/from the MySQL format.

At the end of his post, Qiang says,

My question is:

How do you validate myDateInput as he suggests? What is the rule I should define?

Well i haven’t read this post completely.But i guess what you are trying to achieve.

Define A rule in a Model class and add attribute name ‘myDateInput’.And right the appropriate rule for it.And you can also define a Custom method to validate any of the field in Model class.