loadView() public method

Load a View and convert to HTML
public loadView ( string $view, array $data = [], array $mergeData = [], string $encoding = null ) : static
$view string
$data array
$mergeData array
$encoding string Not used yet
return static
 public function generateTeamPDF(PDF $pdfCreator, Team $team)
 {
     $team = $team::find(Input::get('team'));
     $membersOfTeam = $team->users()->get();
     $pdf = $pdfCreator->loadView('pdf.teamHours', compact('membersOfTeam'));
     return $pdf->stream('Arbeitsstunden');
 }
 /**
  * Load a View and convert to HTML
  *
  * @param string $view
  * @param array $data
  * @param array $mergeData
  * @param string $encoding Not used yet
  * @return static 
  * @static 
  */
 public static function loadView($view, $data = array(), $mergeData = array(), $encoding = null)
 {
     return \Barryvdh\DomPDF\PDF::loadView($view, $data, $mergeData, $encoding);
 }
 public function generatePDF($id)
 {
     $input = array();
     $invoice = Bill::find($id);
     $input['invoice'] = $invoice;
     $input['id'] = $id;
     $company = Company::find($invoice->id);
     //$invoiceData = DB::table("invoice_detail")->where("invoice_id",$id);
     define('BUDGETS_DIR', './invoicexlxs/');
     // I define this in a constants.php file
     $pdfPath = "";
     if (!is_dir(BUDGETS_DIR)) {
         mkdir(BUDGETS_DIR, 0755, true);
     }
     $outputName = $fileurl = "RJLEX_" . strtoupper(substr($company->name, 0, 3)) . "_" . date("Y-M-d") . "_" . time() . ".pdf";
     // str_random is a [Laravel helper](http://laravel.com/docs/helpers#strings)
     $pdfPath = BUDGETS_DIR . '/' . $outputName;
     $invoice->pdf_url = $outputName;
     $invoice->update();
     // File::put($pdfPath, PDF::loadView($pdf, 'A4', 'portrait')->output());
     $pdf = PDF::loadView('invoicing.invoicepdf', $input)->setPaper('a4')->setOrientation('landscape')->save($pdfPath);
 }