Skip to content

Commit e3b0465

Browse files
committed
feat: add inertia response
1 parent d9eaa21 commit e3b0465

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Response.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,21 @@ public function render(string $view, array $data = [])
270270
$this->view($view, $data);
271271
}
272272

273+
/**
274+
* Render an inertia view file if inertia is installed
275+
*
276+
* @param string $view The view file to render
277+
* @param array $data The data to pass to the view
278+
*/
279+
public function inertia(string $view, array $data = [])
280+
{
281+
if (function_exists('inertia')) {
282+
return inertia($view, $data);
283+
}
284+
285+
trigger_error('Inertia not found. Run `leaf install inertia` or `composer require leafs/inertia`');
286+
}
287+
273288
/**
274289
* Output some data and break the application
275290
*

0 commit comments

Comments
 (0)