@@ -9,14 +9,12 @@ class HtmlCard extends Card
9
9
{
10
10
/**
11
11
* The width of the card (1/3, 1/2, or full).
12
- *
13
12
* @var string
14
13
*/
15
14
public $ width = '1/3 ' ;
16
15
17
16
/**
18
17
* Create a new element.
19
- *
20
18
* @param string|null $component
21
19
*/
22
20
public function __construct ($ component = null )
@@ -37,26 +35,14 @@ public function component()
37
35
return 'html-card ' ;
38
36
}
39
37
40
- /**
41
- * Set HTML code to display in a card
42
- *
43
- * @param string $htmlContent
44
- *
45
- * @return HtmlCard
46
- */
47
- public function html (string $ htmlContent )
38
+ /** Set HTML code to display in a card. */
39
+ public function html (string $ htmlContent ): static
48
40
{
49
41
return $ this ->withMeta (['content ' => $ htmlContent ]);
50
42
}
51
43
52
- /**
53
- * Set Markdown code to display in a card (converted into HTML)
54
- *
55
- * @param string $htmlContent
56
- *
57
- * @return HtmlCard
58
- */
59
- public function markdown (string $ markdownContent )
44
+ /** Set Markdown code to display in a card (converted into HTML). */
45
+ public function markdown (string $ markdownContent ): static
60
46
{
61
47
$ htmlContent = App::make (MarkdownConverter::class)::parse ($ markdownContent )->toHtml ();
62
48
@@ -65,27 +51,18 @@ public function markdown(string $markdownContent)
65
51
66
52
/**
67
53
* Use blade view file to render Card content.
68
- *
69
54
* @param string $view
70
- * @param array $viewData
71
- *
72
- * @return HtmlCard
55
+ * @param array<string, mixed> $viewData
73
56
*/
74
- public function view (string $ view , array $ viewData = [])
57
+ public function view (string $ view , array $ viewData = []): static
75
58
{
76
59
$ htmlContent = view ($ view , $ viewData )->render ();
77
60
78
61
return $ this ->html ($ htmlContent );
79
62
}
80
63
81
- /**
82
- * Center card's content
83
- *
84
- * @param bool $centerContent
85
- *
86
- * @return HtmlCard
87
- */
88
- public function center (bool $ centerContent = true )
64
+ /** Center card's content. */
65
+ public function center (bool $ centerContent = true ): static
89
66
{
90
67
return $ this ->withMeta (['center ' => $ centerContent ]);
91
68
}
@@ -96,24 +73,14 @@ public function center(bool $centerContent = true)
96
73
* full-width cards at the bottom. If you want to display full-width cards
97
74
* not at the end, you should use with=1/3 or 2/3 and this method.
98
75
* @see https://github.com/laravel/nova-issues/issues/1895#issuecomment-543684472
99
- *
100
- * @param bool $forceFullWidth
101
- *
102
- * @return HtmlCard
103
76
*/
104
- public function forceFullWidth (bool $ forceFullWidth = true )
77
+ public function forceFullWidth (bool $ forceFullWidth = true ): static
105
78
{
106
79
return $ this ->withMeta (['forceFullWidth ' => $ forceFullWidth ]);
107
80
}
108
81
109
- /**
110
- * Whether to use standard Nova Card styles for a card (background, padding, etc)
111
- *
112
- * @param bool $withoutStyles
113
- *
114
- * @return HtmlCard
115
- */
116
- public function withoutCardStyles (bool $ withoutStyles = true )
82
+ /** Whether to use standard Nova Card styles for a card (background, padding, etc). */
83
+ public function withoutCardStyles (bool $ withoutStyles = true ): static
117
84
{
118
85
return $ this ->withMeta (['withoutCardStyles ' => $ withoutStyles ]);
119
86
}
0 commit comments