Skip to content

Commit e8d9244

Browse files
committed
Update responses.jsx
1 parent 99ed2d2 commit e8d9244

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

resources/js/Pages/responses.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ export default function () {
121121
</P>
122122
<P>
123123
This interface requires a <Code>toInertiaProperty</Code> method that receives a <Code>PropertyContext</Code> object
124-
containing the property key, current props, and request instance.
124+
containing the property key (<Code>$context->key</Code>), all props for the page (<Code>$context->props</Code>), and the
125+
request instance (<Code>$context->request</Code>).
125126
</P>
126127
<TabbedCode
127128
examples={[
@@ -136,7 +137,7 @@ export default function () {
136137
{
137138
public function __construct(protected User $user, protected int $size = 64) {}
138139
139-
public function toInertiaProperty(PropertyContext $prop): mixed
140+
public function toInertiaProperty(PropertyContext $context): mixed
140141
{
141142
return $this->user->avatar
142143
? Storage::url($this->user->avatar)
@@ -182,10 +183,10 @@ export default function () {
182183
{
183184
public function __construct(protected array $items = []) {}
184185
185-
public function toInertiaProperty(PropertyContext $prop): mixed
186+
public function toInertiaProperty(PropertyContext $context): mixed
186187
{
187188
// Access the property key to get shared data
188-
$shared = Inertia::getShared($prop->key, []);
189+
$shared = Inertia::getShared($context->key, []);
189190
190191
// Merge with the new items
191192
return array_merge($shared, $this->items);
@@ -210,7 +211,8 @@ export default function () {
210211
</P>
211212
<P>
212213
This interface requires a <Code>toInertiaProperties</Code> method that returns an array of key-value pairs. The
213-
method receives a <Code>RenderContext</Code> object containing the request and component name.
214+
method receives a <Code>RenderContext</Code> object containing the component name (<Code>$context->component</Code>)
215+
and request instance (<Code>$context->request</Code>).
214216
</P>
215217
<TabbedCode
216218
examples={[

0 commit comments

Comments
 (0)