mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
wip
This commit is contained in:
27
app/helpers.php
Normal file
27
app/helpers.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use function GuzzleHttp\Psr7\str;
|
||||
|
||||
function expose_view_path(string $path = '')
|
||||
{
|
||||
return base_path('resources/views/' . $path);
|
||||
}
|
||||
|
||||
function respond_json($responseData, int $statusCode = 200)
|
||||
{
|
||||
return str(new Response(
|
||||
$statusCode,
|
||||
['Content-Type' => 'application/json'],
|
||||
json_encode($responseData)
|
||||
));
|
||||
}
|
||||
|
||||
function respond_html(string $html, int $statusCode = 200)
|
||||
{
|
||||
return str(new Response(
|
||||
$statusCode,
|
||||
['Content-Type' => 'text/html'],
|
||||
$html
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user