File::requireOnce PHP Method

requireOnce() public static method

Require the given file once.
public static requireOnce ( string $file ) : mixed
$file string
return mixed
        public static function requireOnce($file)
        {
            return \Illuminate\Filesystem\Filesystem::requireOnce($file);
        }

Usage Example

 function pdf($report_id = false)
 {
     $this->pdf = new Pdf();
     File::requireOnce(app_path() . '/library/SVGGraph/SVGGraph.php');
     $this->margins = $this->pdf->getMargins();
     $this->pdf_w = $this->pdf->getPageWidth();
     //check if loading existing PDF
     if ($report_id !== false) {
         $report = json_decode(Report::with('answers')->find($report_id), true);
         if (count($report['answers']) != 6) {
             return Redirect::route('assesment.page1');
         }
         foreach ($report['answers'] as $answer) {
             $answers = json_decode($answer['answers'], true);
             if ($answer['section'] == 'page1') {
                 $this->guest_name = $answers['s1'];
                 $this->guest_company = $answers['s2'];
             }
             if ($answer['section'] == 'page2') {
                 $this->intent_score = $answers['intent_score'];
             }
             if ($answer['section'] == 'page3') {
                 $this->data_score = $answers['data_score'];
             }
             if ($answer['section'] == 'page4') {
                 $this->tech_score = $answers['technology_score'];
             }
             if ($answer['section'] == 'page5') {
                 $this->people_score = $answers['people_score'];
             }
             if ($answer['section'] == 'page6') {
                 $this->process_score = $answers['process_score'];
             }
         }
     } else {
         $this->rData = Session::get('report');
         $this->guest_name = $this->rData['page1']['s1'];
         $this->guest_company = $this->rData['page1']['s2'];
         $this->intent_score = $this->rData['page2']['intent_score'];
         $this->data_score = $this->rData['page3']['data_score'];
         $this->tech_score = $this->rData['page4']['technology_score'];
         $this->people_score = $this->rData['page5']['people_score'];
         $this->process_score = $this->rData['page6']['process_score'];
     }
     $this->overall_score = ($this->intent_score + $this->data_score + $this->tech_score + $this->people_score + $this->process_score) / 5;
     $this->getPDF();
 }
All Usage Examples Of File::requireOnce