add_time.stub 481 B

12345678910111213141516171819202122
  1. protected function setAddTimeAttr($value)
  2. {
  3. return $value ?: time();
  4. }
  5. /**
  6. * 添加时间获取器
  7. * @param $value
  8. * @return false|string
  9. */
  10. public function getAddTimeAttr($value)
  11. {
  12. if (!empty($value)) {
  13. if (is_string($value)) {
  14. return $value;
  15. } elseif (is_int($value)) {
  16. return date('Y-m-d H:i:s', (int)$value);
  17. }
  18. }
  19. return '--';
  20. }