Laravel - 验证日期特定日期

时间:2016-12-05 16:38:10

标签: laravel date php-carbon

我可以为验证设置特定日期吗?

'event_start' => 'required|date|after:today',

例如像这样的东西

 'event_start' => 'required|date|after:Carbon::now()->startOfMonth()',

当然,这不起作用:)

1 个答案:

答案 0 :(得分:3)

试试这个:

Fact

别忘了把它放在命名空间之后:

SELECT
  Main.ID,
  COALESCE(fDescription.Description, dfDescription.Description) Description,
  COALESCE(fDisclaimer.Description, dfDisclaimer.Description) Disclaimer,
  Main.Other
FROM Main
LEFT OUTER JOIN Fact fDescription
  ON fDescription.FactLinkID = Main.DescriptionID
   AND fDescription.ClientID = @clientID
   AND fDescription.LanguageID = @langID
   AND fDescription.StatusID = @statusID -- This actually needs to get the largest `StatusOrder`, not the `StatusID`.
LEFT OUTER JOIN Fact dfDescription
  ON dfDescription.FactLinkID = Main.DescriptionID
   AND dfDescription.ClientID = 1
   AND dfDescription.LanguageID = @langID
   AND dfDescription.StatusID = @statusID
... -- Same for Disclaimer
WHERE Main.ID = 50