25 lines
688 B
PHP
25 lines
688 B
PHP
<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
use App\Http\Middleware\HandleInertiaRequests;
|
|
|
|
class InertiaErrorHelper
|
|
{
|
|
/**
|
|
* Render the default error vue.
|
|
*
|
|
* @param Request $request
|
|
* @param integer $status
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
*/
|
|
public static function render(Request $request, int $status): \Symfony\Component\HttpFoundation\Response
|
|
{
|
|
$shared = (new HandleInertiaRequests())->share($request);
|
|
return Inertia::render('Errors/Default', array_merge($shared, [
|
|
'status' => $status,
|
|
]))->toResponse($request)->setStatusCode($status);
|
|
}
|
|
}
|