File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,33 @@ public function noContent()
232232 $ this ->send ();
233233 }
234234
235+ /**
236+ * Render a view file if a view engine is available
237+ *
238+ * @param string $view The view file to render
239+ * @param array $data The data to pass to the view
240+ */
241+ public function view (string $ view , array $ data = [])
242+ {
243+ if (!function_exists ('view ' )) {
244+ $ this ->markup (
245+ view ($ view , $ data ),
246+ );
247+ }
248+
249+ if (app ()->blade ()) {
250+ $ this ->markup (
251+ app ()->blade ()->render ($ view , $ data ),
252+ );
253+ }
254+
255+ if (app ()->template ()) {
256+ $ this ->markup (
257+ app ()->template ()->render ($ view , $ data ),
258+ );
259+ }
260+ }
261+
235262 /**
236263 * Output some data and break the application
237264 *
You can’t perform that action at this time.
0 commit comments