Skip to content

Commit 2c1e52f

Browse files
Fix inertiaProps method to correctly handle optional prop name for retrieving Inertia props
1 parent 2b1d63f commit 2c1e52f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Testing/TestResponseMacros.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ public function inertiaPage()
2929
};
3030
}
3131

32-
public function inertiaProps(?string $propName = null): mixed
32+
public function inertiaProps()
3333
{
34-
return Arr::get(
35-
$this->inertiaPage()['props'] ?? [],
36-
$propName
37-
);
34+
return function (?string $propName = null) {
35+
return Arr::get(
36+
$this->inertiaPage()['props'] ?? [],
37+
$propName
38+
);
39+
};
3840
}
3941
}

0 commit comments

Comments
 (0)