Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Sep 17, 2023
1 parent a3e4c67 commit e65d3af
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ Configure::write('CakePdf', [
```

```php
use CakePdf\View\Pdfiew;

class InvoicesController extends AppController
{
// In your Invoices controller you could set additional configs,
Expand All @@ -128,6 +130,18 @@ class InvoicesController extends AppController
);
$this->set('invoice', $invoice);
}

/**
* Add Pdfiew::class to this $viewClasses property so that CakePHP automatically
* switches the view class for URLs ending with `.pdf` or with appropriate `Accept` header.
*
* @see https://book.cakephp.org/5/en/controllers.html#content-type-negotiation
* @var array<string>
*/
public function viewClasses(): array
{
return $this->viewClasses[] = Pdfiew::class;
}
}
```

Expand Down

0 comments on commit e65d3af

Please sign in to comment.