File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 18
18
use App \Services \Forge \Pipeline \FindServer ;
19
19
use App \Services \Forge \Pipeline \FindSiteOrFail ;
20
20
use App \Services \Forge \Pipeline \RemoveDatabaseUser ;
21
+ use App \Services \Forge \Pipeline \RemoveInertiaSupport ;
21
22
use App \Services \Forge \Pipeline \RemoveTaskScheduler ;
22
23
use App \Services \Forge \Pipeline \RunOptionalCommands ;
23
24
use App \Traits \Outputifier ;
@@ -38,6 +39,7 @@ public function handle(ForgeService $service): void
38
39
->through ([
39
40
FindServer::class,
40
41
FindSiteOrFail::class,
42
+ RemoveInertiaSupport::class,
41
43
RunOptionalCommands::class,
42
44
RemoveTaskScheduler::class,
43
45
RemoveDatabaseUser::class,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * This file is part of Laravel Harbor.
7
+ *
8
+ * (c) Mehran Rasulian <[email protected] >
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE
11
+ * file that was distributed with this source code.
12
+ */
13
+
14
+ namespace App \Services \Forge \Pipeline ;
15
+
16
+ use App \Services \Forge \ForgeService ;
17
+ use App \Traits \Outputifier ;
18
+ use Closure ;
19
+ use Illuminate \Support \Arr ;
20
+ use Laravel \Forge \Resources \Daemon ;
21
+
22
+ class RemoveInertiaSupport
23
+ {
24
+ use Outputifier;
25
+
26
+ public function __invoke (ForgeService $ service , Closure $ next )
27
+ {
28
+ if (! $ service ->setting ->inertiaSsrEnabled ) {
29
+ return $ next ($ service );
30
+ }
31
+
32
+ if ($ daemon = $ this ->getInertiaDaemon ($ service )) {
33
+ $ this ->information ('Removing the daemon for Inertia.js SSR command. ' );
34
+
35
+ $ service ->forge ->deleteDaemon ($ service ->server ->id , $ daemon ->id );
36
+ }
37
+
38
+ return $ next ($ service );
39
+ }
40
+
41
+ protected function getInertiaDaemon (ForgeService $ service ): ?Daemon
42
+ {
43
+ $ daemons = $ service ->forge ->daemons ($ service ->server ->id );
44
+ $ command = 'php artisan inertia:start-ssr ' ;
45
+
46
+ return Arr::first (
47
+ $ daemons ,
48
+ fn ($ daemon ) => $ daemon ->directory == $ service ->siteDirectory () && $ daemon ->command == $ command
49
+ );
50
+ }
51
+ }
You can’t perform that action at this time.
0 commit comments