创建时间处理
This commit is contained in:
@@ -50,6 +50,7 @@ class CustomerController extends BaseController
|
||||
: null);
|
||||
foreach ($data['records'] as &$item) {
|
||||
$item = $this->service->getCustomer($item);
|
||||
$item = Util::formatDate($item,['created_at','updated_at']);
|
||||
}
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@@ -20,11 +20,7 @@ class Conversation extends Model
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = true;
|
||||
protected $dateFormat = 'U';
|
||||
protected $dates = ['created_at', 'updated_at'];
|
||||
protected $casts = [
|
||||
'updated_at' => 'datetime:Y-m-d H:i:s',
|
||||
'created_at' => 'datetime:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'ticket_id',
|
||||
'user_id',
|
||||
|
||||
@@ -35,6 +35,8 @@ class ConversationService
|
||||
$user = User::where('id', $value['user_id'])->first();
|
||||
$value['user_name'] = $user?->name;
|
||||
$value['user_avatar'] = $user?->avatar;
|
||||
$value['created_at'] = date('Y-m-d H:i:s', strtotime($value['created_at']));
|
||||
$value['updated_at'] = date('Y-m-d H:i:s', strtotime($value['updated_at']));
|
||||
$result[$key] = $value;
|
||||
}
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user