How to remove blank line in csv file using laravel maatwebsite

I want to export csv file using Maatwebsite in laravel. The process is running well, but in the csv file contains blank line in last data when i open it using notepad. Displayed at image below

enter image description here

This is the function to get the data

public function view(): View  {     $data = DB::table('transaction as a')                 ->join('transaction_details as b', 'a.id', 'b.header_id')                 ->select('b.order_number', 'b.changed_number')                 ->whereIn('a.id', $this->id)                 ->where('a.approve', 1)                 ->get();          return view('vendor.voyager.transaction.excel-csv.generate-csv', [       'data' => $data     ]); }  public function getCsvSettings(): array {     return [         'enclosure' => ''     ]; } 

This is function to call the function above

public function generate(Request $request) {      $id = $request->ids;      return Excel::store(new ExportTransaction($id), 'test.csv', 'ftp'); } 

How to solve my problem to remove blank line in the csv fie

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.