feat: hồ sơ khách (ngày sinh, tỉnh/phường theo mã), gộp menu + nút tắt, thông báo theo uuid
- PUT v1/client/update: gender theo enum ClientGender (0 Nam/1 Nữ), thêm
birthday (cột mới), province_code/ward_code validate theo bảng provinces/wards
(phường phải thuộc tỉnh). Migration nạp dữ liệu hành chính 2025 từ
province_ward_import.sql (chỉ bảng trống), API GET v1/provinces[/{code}/wards].
- CustomerObserver/OrderObserver log giá trị cũ bằng getRawOriginal: getOriginal
trả enum object, nối chuỗi gây 500 khi khách đổi giới tính.
- ClientResource: các cờ trả boolean, CCCD chỉ trả cccd_updated (không lộ ảnh/số).
- GET v1/setting/menu trả cả items + quick_links, bỏ v1/setting/quick-links.
- Thông báo admin/khách tra theo uuid thay vì id tự tăng.
- Chặn gửi template marketing cho khách đã tắt nhận email marketing.
- Xoá ProvinceWardSeeder và Customer::$updatable không dùng.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
12d5b4951c
commit
bf78f3b810
+3
-12
@@ -65,21 +65,11 @@ class Customer extends Authenticatable implements JWTSubject
|
||||
'remember_token',
|
||||
'status',
|
||||
'gender',
|
||||
'birthday',
|
||||
'province_code',
|
||||
'ward_code',
|
||||
];
|
||||
|
||||
protected $updatable = [
|
||||
'fullname',
|
||||
'username',
|
||||
'phone',
|
||||
'company',
|
||||
'address',
|
||||
'province_code',
|
||||
'ward_code',
|
||||
'gender',
|
||||
];
|
||||
|
||||
/**
|
||||
* Appends for API
|
||||
*/
|
||||
@@ -92,6 +82,7 @@ class Customer extends Authenticatable implements JWTSubject
|
||||
'gender' => \App\Enums\Client\ClientGender::class,
|
||||
'email_verified_at' => 'datetime',
|
||||
'two_factor_enabled' => 'boolean',
|
||||
'birthday' => 'date',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -200,7 +191,7 @@ class Customer extends Authenticatable implements JWTSubject
|
||||
return $this->hasMany(Log::class);
|
||||
}
|
||||
|
||||
public function getEmailMarketingBoolAttribute()
|
||||
public function acceptsMarketingEmail(): bool
|
||||
{
|
||||
return (bool) $this->email_marketing;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,11 @@ class MailCampaign extends Model
|
||||
});
|
||||
}
|
||||
|
||||
public function isMarketing(): bool
|
||||
{
|
||||
return $this->template === null || $this->template->isMarketing();
|
||||
}
|
||||
|
||||
public function logs()
|
||||
{
|
||||
return $this->hasMany(Mail::class, 'campaign_id');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Customer;
|
||||
@@ -9,7 +10,14 @@ use App\Models\User;
|
||||
|
||||
class Notification extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasFactory, HasUuids;
|
||||
|
||||
protected $hidden = ['id'];
|
||||
|
||||
public function uniqueIds(): array
|
||||
{
|
||||
return ['uuid'];
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'recipient_type',
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Support\EmailScenarioRegistry;
|
||||
use App\Support\EmailTemplateShell;
|
||||
use App\Support\MailGlobals;
|
||||
use App\Support\MailPlaceholders;
|
||||
@@ -53,6 +54,11 @@ class Template extends Model
|
||||
}
|
||||
}
|
||||
|
||||
public function isMarketing(): bool
|
||||
{
|
||||
return EmailScenarioRegistry::describe($this->key, $this->scenario)['category'] === EmailScenarioRegistry::MARKETING;
|
||||
}
|
||||
|
||||
/** Danh sách variable hợp lệ khai báo trong metadata.variables, key theo variable key. */
|
||||
public function variables(): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user