From b68dcf5f861655cc07fb7a6a7154a557fb790baf Mon Sep 17 00:00:00 2001 From: Massimo Triassi Date: Tue, 18 Jun 2024 17:01:28 -0400 Subject: [PATCH] docs: #12 add missing ->layout() usage --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 1473e8e..bf60f1c 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,15 @@ class Page extends Model implements Contentable, Layoutable protected static $globalLayouts = false; } ``` +Contentable exposes a function that make it easy to have a particular instance of a model use its set layout. Simply call `->layout()` on it, and pass that to the chosen render function. + +eg: +```php +public function show(Page $page): \Illuminate\View\View +{ + return view($page->layout())->with(compact('page')); +} +```