Skip to content

Commit 1a11d50

Browse files
committed
#1 Support rendering of blade views
1 parent 2fbe0ff commit 1a11d50

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ Then, register your new link in the `cards` method of the `NovaServiceProvider`
1616
public function cards()
1717
{
1818
return [
19-
(new HtmlCard())->width('1/3')->html('<h1>Hello!</h1>'),
20-
(new HtmlCard())->width('1/3')->markdown('# Hello!'),
19+
(new HtmlCard())->width('1/3')->html('<h1>Hello World!</h1>'),
20+
(new HtmlCard())->width('1/3')->markdown('# Hello World!'),
21+
(new HtmlCard())->width('1/3')->view('cards.hello', ['name' => 'World']),
2122
];
2223
}
2324
```

src/HtmlCard.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,19 @@ public function markdown(string $markdownContent)
6060

6161
return $this->html($htmlContent);
6262
}
63+
64+
/**
65+
* Use blade view file to render Card content.
66+
*
67+
* @param string $view
68+
* @param array $viewData
69+
*
70+
* @return HtmlCard
71+
*/
72+
public function view(string $view, array $viewData = [])
73+
{
74+
$htmlContent = view($view, $viewData);
75+
76+
return $this->html($htmlContent);
77+
}
6378
}

0 commit comments

Comments
 (0)