Skip to content

Commit

Permalink
MOD update readme
Browse files Browse the repository at this point in the history
MOD clean up code
  • Loading branch information
SuryaWebfox committed Jun 22, 2023
1 parent 06c6984 commit a4c71ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,7 @@ class DemoController extends Controller
{
public function show(Request $request, Demo $demo)
{
if ($request->get('json')) {
return (new DemoDataProvider($demo))->toNestedArray();
}

$pageData = DataProvider::collection(
new TabDataProvider(current: 'demo'),
new DemoDataProvider($demo),
);

if($demo->has_venue) {
$pageData->add(new CreateVenueDataProvider($demo));
}

return Inertia::render('DemoPage', $pageData);
return (new DemoDataProvider($demo))->toNestedArray();
}
}
```
Expand Down
4 changes: 1 addition & 3 deletions src/DataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function toArray(): array
->filter(fn (ReflectionMethod $method) => ! $method->isStatic() && ! in_array($method->name, $this->excludedMethods))
->mapWithKeys(function (ReflectionMethod $method) {
$returnType = $method->getReturnType();
// @phpstan-ignore-next-line
if ($returnType instanceof ReflectionNamedType && $returnType->getName() === LazyProp::class) {
return [$method->name => $method->invoke($this)];
}
Expand All @@ -58,8 +57,7 @@ public function toNestedArray(): array

public function dump(): static
{
$props = $this->toNestedArray();
VarDumper::dump($props);
VarDumper::dump($this->toNestedArray());

return $this;
}
Expand Down

0 comments on commit a4c71ff

Please sign in to comment.