| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Spatie\LaravelIgnition\Renderers;
|
|
|
4 |
|
|
|
5 |
use Spatie\FlareClient\Flare;
|
|
|
6 |
use Spatie\Ignition\Config\IgnitionConfig;
|
|
|
7 |
use Spatie\Ignition\Contracts\SolutionProviderRepository;
|
|
|
8 |
use Spatie\Ignition\Ignition;
|
|
|
9 |
use Spatie\LaravelIgnition\ContextProviders\LaravelContextProviderDetector;
|
|
|
10 |
use Spatie\LaravelIgnition\Solutions\SolutionTransformers\LaravelSolutionTransformer;
|
|
|
11 |
use Spatie\LaravelIgnition\Support\LaravelDocumentationLinkFinder;
|
|
|
12 |
use Throwable;
|
|
|
13 |
|
|
|
14 |
class ErrorPageRenderer
|
|
|
15 |
{
|
|
|
16 |
public function render(Throwable $throwable): void
|
|
|
17 |
{
|
|
|
18 |
$vitejsAutoRefresh = '';
|
|
|
19 |
|
|
|
20 |
if (class_exists('Illuminate\Foundation\Vite')) {
|
|
|
21 |
$vite = app(\Illuminate\Foundation\Vite::class);
|
|
|
22 |
|
|
|
23 |
if (is_file($vite->hotFile())) {
|
|
|
24 |
$vitejsAutoRefresh = $vite->__invoke([]);
|
|
|
25 |
}
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
app(Ignition::class)
|
|
|
29 |
->resolveDocumentationLink(
|
|
|
30 |
fn (Throwable $throwable) => (new LaravelDocumentationLinkFinder())->findLinkForThrowable($throwable)
|
|
|
31 |
)
|
|
|
32 |
->setFlare(app(Flare::class))
|
|
|
33 |
->setConfig(app(IgnitionConfig::class))
|
|
|
34 |
->setSolutionProviderRepository(app(SolutionProviderRepository::class))
|
|
|
35 |
->setContextProviderDetector(new LaravelContextProviderDetector())
|
|
|
36 |
->setSolutionTransformerClass(LaravelSolutionTransformer::class)
|
|
|
37 |
->applicationPath(base_path())
|
|
|
38 |
->addCustomHtmlToHead($vitejsAutoRefresh)
|
|
|
39 |
->renderException($throwable);
|
|
|
40 |
}
|
|
|
41 |
}
|