CommunityBusiness.php 524 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class CommunityBusiness extends Model
  5. {
  6. public function getRecordDateAttr($value){
  7. if ($value) {
  8. return date('Y-m-d', $value);
  9. }
  10. return '';
  11. }
  12. public function setRecordDateAttr($value){
  13. if ($value){
  14. return strtotime($value);
  15. }
  16. return 0;
  17. }
  18. public function communityName(){
  19. return $this->hasOne(Community::class, 'id', 'community_id')->bind(['community_name'=> 'name']);
  20. }
  21. }