From eb11b11d374f36a385067231699af4f67465dcff Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Mon, 15 Mar 2021 12:59:25 +0530 Subject: [PATCH] PDF ka chakkar babu bhaiya --- .../Agent/helpdesk/TicketController.php | 16 ++++++++++++---- routes/web.php | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index 86d457edf..3a40fcb9b 100755 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -498,8 +498,12 @@ class TicketController extends Controller $ticket = Tickets::where('tickets.id', '=', $id)->first(); $html = view('themes.default1.agent.helpdesk.ticket.pdf', compact('id', 'ticket', 'tickets'))->render(); $html1 = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'); - - return PDF::load($html1)->show(); + /** + * This statement throws error with php7.1 + * @see https://github.com/dompdf/dompdf/issues/1272 + * For time bieng we are silencing the error using "@" operator in front of it + */ + return @PDF::load($html1)->show(); } /** @@ -2430,8 +2434,12 @@ class TicketController extends Controller $ticket = Tickets::where('id', $thread->ticket_id)->first(); $html = view('themes.default1.agent.helpdesk.ticket.thread-pdf', compact('thread', 'system', 'company', 'ticket'))->render(); $html1 = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'); - - return PDF::load($html1)->show(); + /** + * This statement throws error with php7.1 + * @see https://github.com/dompdf/dompdf/issues/1272 + * For time bieng we are silencing the error using "@" operator in front of it + */ + return @PDF::load($html1)->show(); } catch (Exception $ex) { return redirect()->back()->with('fails', $ex->getMessage()); } diff --git a/routes/web.php b/routes/web.php index b4095202b..5fcd0cc68 100644 --- a/routes/web.php +++ b/routes/web.php @@ -346,7 +346,7 @@ Route::group(['middleware' => ['web']], function () { Route::patch('/internal/note/{id}', ['as' => 'Internal.note', 'uses' => 'Agent\helpdesk\TicketController@InternalNote']); /* Patch Internal Note */ Route::patch('/ticket/assign/{id}', ['as' => 'assign.ticket', 'uses' => 'Agent\helpdesk\TicketController@assign']); /* Patch Ticket assigned to whom */ Route::patch('/ticket/post/edit/{id}', ['as' => 'ticket.post.edit', 'uses' => 'Agent\helpdesk\TicketController@ticketEditPost']); /* Patchi Ticket Edit */ - Route::post('/ticket/print/{id}', ['as' => 'ticket.print', 'uses' => 'Agent\helpdesk\TicketController@ticket_print']); /* Get Print Ticket */ + Route::get('/ticket/print/{id}', ['as' => 'ticket.print', 'uses' => 'Agent\helpdesk\TicketController@ticket_print']); /* Get Print Ticket */ Route::post('/ticket/close/{id}', ['as' => 'ticket.close', 'uses' => 'Agent\helpdesk\TicketController@close']); /* Get Ticket Close */ Route::post('/ticket/resolve/{id}', ['as' => 'ticket.resolve', 'uses' => 'Agent\helpdesk\TicketController@resolve']); /* Get ticket Resolve */ Route::post('/ticket/open/{id}', ['as' => 'ticket.open', 'uses' => 'Agent\helpdesk\TicketController@open']); /* Get Ticket Open */