'array', 'content'=>'json', ]; public function getCreatedAtTextAttr($value, $data) { $value = $value ? $value : (isset($data['created_at']) ? $data['created_at'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setCreatedAtAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } /** * @return User|BelongsTo */ public function user() { return $this->belongsTo(User::class)->removeOption('soft_delete'); } public function deal($body){ $this['deal_at']=time(); $this['deal_body']=$body; $this->save(); } public function scopeWait(Query $query,$un=true){ if($un) { $query->whereNull('deal_at'); }else{ $query->whereNotNull('deal_at'); } } }