diff --git a/app/Exports/customer_export.php b/app/Exports/customer_export.php index 9aad372..14fbc02 100644 --- a/app/Exports/customer_export.php +++ b/app/Exports/customer_export.php @@ -13,14 +13,16 @@ class customer_export implements FromCollection , WithHeadings /** * @return \Illuminate\Support\Collection */ - public function collection() - { - return IamPrincipal::select( - 'first_name', - 'email_address', - 'date_of_birth', - 'phone_number' - )->get(); + + + public function collection(){ + return IamPrincipal::where('principal_type_xid',3) + ->select('first_name', + 'email_address', + 'date_of_birth', + 'phone_number')->get(); + + } //function header in excel @@ -33,4 +35,6 @@ class customer_export implements FromCollection , WithHeadings 'phone_number' ]; } + + } diff --git a/app/Http/Controllers/Admin/ManageCustomerController.php b/app/Http/Controllers/Admin/ManageCustomerController.php index a83de51..c0657cc 100644 --- a/app/Http/Controllers/Admin/ManageCustomerController.php +++ b/app/Http/Controllers/Admin/ManageCustomerController.php @@ -238,23 +238,7 @@ class ManageCustomerController extends Controller } } - // public function exportSelectedCustomer(Request $request) - // { - // $data=null; - // $type = $request->input('type'); // 'overview' or 'selected' - - // if ($type === 'overview') { - // // Fetch all data from the database - // $data = IamPrincipal::all(); - // } elseif ($type === 'selected') { - // // Fetch selected data based on IDs - // $selectedIds = $request->input('selected_ids'); - // $data = IamPrincipal ::whereIn('id', $selectedIds)->get(); - // } - - // // Generate Excel - // return Excel::download(new customer_export($data), 'customers.xlsx'); - // } + /*