Add Line ID field to member lifecycle

This commit is contained in:
2026-02-10 15:31:29 +08:00
parent 860dbfb54e
commit f0dbea1af5
18 changed files with 124 additions and 9 deletions

View File

@@ -85,6 +85,7 @@ class ImportMembers extends Command
$memberNumber = isset($indexes['member_number']) ? trim($row[$indexes['member_number']] ?? '') : '';
$nationalId = isset($indexes['national_id']) ? trim($row[$indexes['national_id']] ?? '') : '';
$phone = trim($row[$indexes['phone']] ?? '');
$lineId = isset($indexes['line_id']) ? trim($row[$indexes['line_id']] ?? '') : '';
$phoneHome = isset($indexes['phone_home']) ? trim($row[$indexes['phone_home']] ?? '') : '';
$phoneFax = isset($indexes['phone_fax']) ? trim($row[$indexes['phone_fax']] ?? '') : '';
$birthDate = isset($indexes['birth_date']) ? trim($row[$indexes['birth_date']] ?? '') : '';
@@ -125,6 +126,7 @@ class ImportMembers extends Command
'email' => $email,
'national_id' => $nationalId !== '' ? $nationalId : null,
'phone' => $phone !== '' ? $phone : null,
'line_id' => $lineId !== '' ? $lineId : null,
'phone_home' => $phoneHome !== '' ? $phoneHome : null,
'phone_fax' => $phoneFax !== '' ? $phoneFax : null,
'birth_date' => $birthDate !== '' ? $birthDate : null,

View File

@@ -17,12 +17,13 @@ class AdminMemberController extends Controller
{
$query = Member::query()->with('user');
// Text search (name, email, phone, national ID)
// Text search (name, email, phone, Line ID, national ID)
if ($search = $request->string('search')->toString()) {
$query->where(function ($q) use ($search) {
$q->where('full_name', 'like', "%{$search}%")
->orWhere('email', 'like', "%{$search}%")
->orWhere('phone', 'like', "%{$search}%");
->orWhere('phone', 'like', "%{$search}%")
->orWhere('line_id', 'like', "%{$search}%");
// Search by national ID hash if provided
if (!empty($search)) {
@@ -256,7 +257,13 @@ class AdminMemberController extends Controller
if ($search = $request->string('search')->toString()) {
$query->where(function ($q) use ($search) {
$q->where('full_name', 'like', "%{$search}%")
->orWhere('email', 'like', "%{$search}%");
->orWhere('email', 'like', "%{$search}%")
->orWhere('phone', 'like', "%{$search}%")
->orWhere('line_id', 'like', "%{$search}%");
if (!empty($search)) {
$q->orWhere('national_id_hash', hash('sha256', $search));
}
});
}
@@ -276,6 +283,7 @@ class AdminMemberController extends Controller
'Full Name',
'Email',
'Phone',
'Line ID',
'Address Line 1',
'Address Line 2',
'City',
@@ -297,6 +305,7 @@ class AdminMemberController extends Controller
$member->full_name,
$member->email,
$member->phone,
$member->line_id,
$member->address_line_1,
$member->address_line_2,
$member->city,

View File

@@ -54,6 +54,7 @@ class MemberDashboardController extends Controller
$validated = $request->validate([
'full_name' => ['required', 'string', 'max:255'],
'phone' => ['nullable', 'string', 'max:20'],
'line_id' => ['nullable', 'string', 'max:100'],
'national_id' => ['nullable', 'string', 'max:20'],
'address_line_1' => ['nullable', 'string', 'max:255'],
'address_line_2' => ['nullable', 'string', 'max:255'],
@@ -69,6 +70,7 @@ class MemberDashboardController extends Controller
'full_name' => $validated['full_name'],
'email' => $user->email,
'phone' => $validated['phone'] ?? null,
'line_id' => $validated['line_id'] ?? null,
'national_id' => $validated['national_id'] ?? null,
'address_line_1' => $validated['address_line_1'] ?? null,
'address_line_2' => $validated['address_line_2'] ?? null,
@@ -88,4 +90,4 @@ class MemberDashboardController extends Controller
return redirect()->route('member.dashboard')
->with('status', __('Profile completed! Please submit your membership payment.'));
}
}
}

View File

@@ -32,6 +32,7 @@ class PublicMemberRegistrationController extends Controller
'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email', 'unique:members,email'],
'password' => ['required', 'confirmed', Password::defaults()],
'phone' => ['nullable', 'string', 'max:20'],
'line_id' => ['nullable', 'string', 'max:100'],
'national_id' => ['nullable', 'string', 'max:20'],
'address_line_1' => ['nullable', 'string', 'max:255'],
'address_line_2' => ['nullable', 'string', 'max:255'],
@@ -57,6 +58,7 @@ class PublicMemberRegistrationController extends Controller
'full_name' => $validated['full_name'],
'email' => $validated['email'],
'phone' => $validated['phone'] ?? null,
'line_id' => $validated['line_id'] ?? null,
'national_id' => $validated['national_id'] ?? null,
'address_line_1' => $validated['address_line_1'] ?? null,
'address_line_2' => $validated['address_line_2'] ?? null,

View File

@@ -27,6 +27,7 @@ class StoreMemberRequest extends FormRequest
'email' => ['required', 'email', 'max:255', 'unique:users,email'],
'national_id' => ['nullable', 'string', 'max:50'],
'phone' => ['nullable', 'string', 'max:50'],
'line_id' => ['nullable', 'string', 'max:100'],
'phone_home' => ['nullable', 'string', 'max:50'],
'phone_fax' => ['nullable', 'string', 'max:50'],
'birth_date' => ['nullable', 'date'],

View File

@@ -33,6 +33,7 @@ class UpdateMemberRequest extends FormRequest
'email' => ['required', 'email', 'max:255'],
'national_id' => ['nullable', 'string', 'max:50'],
'phone' => ['nullable', 'string', 'max:50'],
'line_id' => ['nullable', 'string', 'max:100'],
'phone_home' => ['nullable', 'string', 'max:50'],
'phone_fax' => ['nullable', 'string', 'max:50'],
'birth_date' => ['nullable', 'date'],

View File

@@ -42,6 +42,7 @@ class Member extends Model
'full_name',
'email',
'phone',
'line_id',
'phone_home',
'phone_fax',
'address_line_1',