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
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('notifications', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->nullable()->after('id');
|
||||
});
|
||||
|
||||
DB::table('notifications')->whereNull('uuid')->orderBy('id')->chunkById(500, function ($rows) {
|
||||
foreach ($rows as $row) {
|
||||
DB::table('notifications')->where('id', $row->id)->update(['uuid' => (string) Str::uuid7()]);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('notifications', function (Blueprint $table) {
|
||||
$table->uuid('uuid')->nullable(false)->change();
|
||||
$table->unique('uuid');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('notifications', function (Blueprint $table) {
|
||||
$table->dropUnique(['uuid']);
|
||||
$table->dropColumn('uuid');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('customers', function (Blueprint $table) {
|
||||
$table->date('birthday')->nullable()->after('gender');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('customers', function (Blueprint $table) {
|
||||
$table->dropColumn('birthday');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
$statements = preg_split('/;\s*\n/', File::get(database_path('province_ward_import.sql')));
|
||||
$filled = [];
|
||||
|
||||
foreach ($statements as $statement) {
|
||||
if (!preg_match('/INSERT INTO (\w+)/', $statement, $match)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$table = $match[1];
|
||||
$filled[$table] ??= DB::table($table)->exists();
|
||||
|
||||
if (!$filled[$table]) {
|
||||
DB::unprepared($statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class ProvinceWardSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$path = database_path('province_ward_import.sql');
|
||||
|
||||
if (File::exists($path)) {
|
||||
// Read and execute the SQL file
|
||||
$sql = File::get($path);
|
||||
|
||||
// Execute the SQL commands
|
||||
DB::unprepared($sql);
|
||||
|
||||
$this->command->info('Province/Ward data imported successfully from SQL file.');
|
||||
} else {
|
||||
$this->command->error('File database/province_ward_import.sql not found.');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user