The below code shows a method which creates a PDF file with DomPDF plugin in Laravel.
In the last line of code working as will open a dialog for saving the file. But, this code saves "is_print" value as 1 before clicking the submit button..
Do you have any idea how to check the submit button click status in JavaScript or other?
public function customer(Request $request)
{
//update "is_print" sign 0 to 1 when before Print out.
$jobs = Job::onlyTrashed()
->whereIn('id', explode(', ', $request->input('job_ids')))
->update(['is_print' => 1]);
//print out with name as "customer_rapport.pdf".
return $pdf->download('customer_rapport.pdf');
}