4
4
5
5
use Inertia \Inertia ;
6
6
use Illuminate \Support \Str ;
7
- use Illuminate \Http \Response ;
8
7
use Illuminate \Support \Facades \File ;
9
- use Illuminate \Http \RedirectResponse ;
10
8
use Arcanist \Contracts \ResponseRenderer ;
11
9
use Illuminate \Contracts \Support \Renderable ;
12
10
use Illuminate \Contracts \Support \Responsable ;
11
+ use Symfony \Component \HttpFoundation \Response ;
13
12
use Arcanist \Exception \StepTemplateNotFoundException ;
14
13
15
14
class InertiaResponseRenderer implements ResponseRenderer
@@ -18,8 +17,11 @@ public function __construct(private string $componentBasePath)
18
17
{
19
18
}
20
19
21
- public function renderStep (WizardStep $ step , AbstractWizard $ wizard , array $ data = []): Response | Responsable | Renderable
22
- {
20
+ public function renderStep (
21
+ WizardStep $ step ,
22
+ AbstractWizard $ wizard ,
23
+ array $ data = []
24
+ ): Response | Responsable | Renderable {
23
25
$ component = $ this ->componentBasePath . '/ ' . Str::studly ($ wizard ::$ slug ) . '/ ' . Str::studly ($ step ->slug );
24
26
$ componentPath = resource_path ('js/Pages/ ' . $ component . '.vue ' );
25
27
@@ -37,7 +39,7 @@ public function renderStep(WizardStep $step, AbstractWizard $wizard, array $data
37
39
return Inertia::render ($ component , $ viewData );
38
40
}
39
41
40
- public function redirect (WizardStep $ step , AbstractWizard $ wizard ): RedirectResponse
42
+ public function redirect (WizardStep $ step , AbstractWizard $ wizard ): Response | Responsable | Renderable
41
43
{
42
44
if (!$ wizard ->exists ()) {
43
45
return redirect ()->route ('wizard. ' . $ wizard ::$ slug . '.create ' );
@@ -49,8 +51,11 @@ public function redirect(WizardStep $step, AbstractWizard $wizard): RedirectResp
49
51
);
50
52
}
51
53
52
- public function redirectWithError (WizardStep $ step , AbstractWizard $ wizard , ?string $ error = null ): RedirectResponse
53
- {
54
+ public function redirectWithError (
55
+ WizardStep $ step ,
56
+ AbstractWizard $ wizard ,
57
+ ?string $ error = null
58
+ ): Response | Responsable | Renderable {
54
59
return redirect ()->route (
55
60
'wizard. ' . $ wizard ::$ slug . '.show ' ,
56
61
[$ wizard ->getId (), $ step ->slug ]
0 commit comments