Abdur Rehman Alvi
Abdur Rehman Alvi

Reputation: 31

Laravel domPdf download issue with php artisan serve

<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\FollowReport;
use App\Models\MatchDetail;
use App\Models\Matche;
use App\Models\Points;
use Highlight\Autoloader;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Intervention\Image\Facades\Image;
use PDF;
class MatchDetailController extends Controller {
   
 public function downlaodReport($id)
    {
        $match = Matche::findOrFail($id);
        $won=  $this->getFinalResult($id);
        $view='';
        $customPaper = '';
        switch ($_GET['name']) {
            case 'omr':
                $view = 'admin/ReportsPdf/report-pdf';
                $customPaper =  array(0, 0, 1200, 2000);
                break;
            case 'pmr':
                $view = 'admin/ReportsPdf/pmr-report';
                $customPaper =  array(0, 0, 1200, 3000);
                break;
            
            default:
                $view = 'admin/ReportsPdf/smr-report';
                $customPaper =  array(0, 0, 1000, 1100);
                break;
        }
       
        $pdf = PDF::loadView($view, compact('match', 'won'))->setPaper($customPaper, 'potrait');
        
        return $pdf->download($_GET['name'].'-report.pdf');
        // return view('admin/ReportsPdf/pmr-report',compact('match','won'));
    }
}

this is my code for controller and when i run my project with php artisan serve i got an error of

Maximum execution time of 60 seconds exceeded when i try to run my project with xampp it works fine any solution for this?

Upvotes: 0

Views: 702

Answers (1)

S N Sharma
S N Sharma

Reputation: 1526

Update your php.ini file

max_execution_time=1500
max_input_time=1000
memory_limit=5000M

You can adjust the value. Restart your server.

Upvotes: 0

Related Questions