From 3c1ffdc0f8fb739660f2dffe40f09c8630c349a5 Mon Sep 17 00:00:00 2001
From: pushuo <229102104@qq.com>
Date: Tue, 30 Aug 2022 17:01:48 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8E=E5=8F=B0=E5=A4=9A?=
=?UTF-8?q?=E8=AF=AD=E8=A8=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Admin/Http/Resources/CustomerResource.php | 1 +
beike/Models/Customer.php | 6 +++
.../views/pages/customers/index.blade.php | 42 +++++++++----------
.../views/pages/products/index.blade.php | 4 ++
resources/lang/zh_cn/admin/customer.php | 5 ---
5 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/beike/Admin/Http/Resources/CustomerResource.php b/beike/Admin/Http/Resources/CustomerResource.php
index 479a7bf1..9d5840e1 100644
--- a/beike/Admin/Http/Resources/CustomerResource.php
+++ b/beike/Admin/Http/Resources/CustomerResource.php
@@ -19,6 +19,7 @@ class CustomerResource extends JsonResource
'name' => $this->name,
'email' => $this->email,
'status' => $this->status,
+ 'created_at' => time_format($this->created_at),
'avatar' => image_resize($this->avatar),
'from' => $this->from,
'customer_group_name' => $this->customerGroup->description->name ?? '',
diff --git a/beike/Models/Customer.php b/beike/Models/Customer.php
index 7c0d0a6c..5607f4f2 100644
--- a/beike/Models/Customer.php
+++ b/beike/Models/Customer.php
@@ -2,6 +2,7 @@
namespace Beike\Models;
+use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -18,6 +19,11 @@ class Customer extends Authenticatable
protected $fillable = ['name', 'email', 'password', 'status', 'avatar', 'customer_group_id', 'locale', 'status', 'from'];
+ protected function serializeDate(\DateTimeInterface $date): string
+ {
+ return Carbon::createFromFormat('Y-m-d H:i:s', $date)->format('Y-m-d H:i:s');
+ }
+
public function addresses(): HasMany
{
return $this->hasMany(Address::class);
diff --git a/resources/beike/admin/views/pages/customers/index.blade.php b/resources/beike/admin/views/pages/customers/index.blade.php
index 14eea72b..a01bb9ae 100644
--- a/resources/beike/admin/views/pages/customers/index.blade.php
+++ b/resources/beike/admin/views/pages/customers/index.blade.php
@@ -85,31 +85,31 @@
:total="customers.total">
-