Skip to content

Commit

Permalink
docs: #12 add missing ->layout() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
m-triassi committed Jun 18, 2024
1 parent 6ae8fa1 commit b68dcf5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
```

 

Expand Down

0 comments on commit b68dcf5

Please sign in to comment.