Skip to content

Commit 3541bfa

Browse files
committed
Boot view logic in ViewServiceProvider
1 parent 25ce206 commit 3541bfa

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

packages/framework/src/Foundation/Providers/ViewServiceProvider.php

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace Hyde\Foundation\Providers;
66

7+
use Hyde\Framework\Views\Components\LinkComponent;
8+
use Hyde\Hyde;
9+
use Illuminate\Support\Facades\Blade;
710
use Illuminate\Support\ServiceProvider;
811

912
class ViewServiceProvider extends ServiceProvider
@@ -15,6 +18,32 @@ public function register(): void
1518

1619
public function boot(): void
1720
{
18-
//
21+
$this->loadViewsFrom(__DIR__.'/../../resources/views', 'hyde');
22+
23+
$this->publishes([
24+
__DIR__.'/../../resources/views/layouts' => resource_path('views/vendor/hyde/layouts'),
25+
], 'hyde-layouts');
26+
27+
$this->publishes([
28+
__DIR__.'/../../resources/views/components' => resource_path('views/vendor/hyde/components'),
29+
], 'hyde-components');
30+
31+
$this->publishes([
32+
Hyde::vendorPath('resources/views/pages/404.blade.php') => Hyde::path('_pages/404.blade.php'),
33+
], 'hyde-page-404');
34+
35+
$this->publishes([
36+
Hyde::vendorPath('resources/views/homepages/welcome.blade.php') => Hyde::path('_pages/index.blade.php'),
37+
], 'hyde-welcome-page');
38+
39+
$this->publishes([
40+
Hyde::vendorPath('resources/views/homepages/post-feed.blade.php') => Hyde::path('_pages/index.blade.php'),
41+
], 'hyde-posts-page');
42+
43+
$this->publishes([
44+
Hyde::vendorPath('resources/views/homepages/blank.blade.php') => Hyde::path('_pages/index.blade.php'),
45+
], 'hyde-blank-page');
46+
47+
Blade::component('link', LinkComponent::class);
1948
}
2049
}

packages/framework/src/Framework/HydeServiceProvider.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
use Hyde\Foundation\Providers\ViewServiceProvider;
1212
use Hyde\Framework\Concerns\RegistersFileLocations;
1313
use Hyde\Framework\Services\AssetService;
14-
use Hyde\Framework\Views\Components\LinkComponent;
1514
use Hyde\Hyde;
1615
use Hyde\Markdown\MarkdownConverter;
1716
use Hyde\Pages\BladePage;
1817
use Hyde\Pages\DocumentationPage;
1918
use Hyde\Pages\HtmlPage;
2019
use Hyde\Pages\MarkdownPage;
2120
use Hyde\Pages\MarkdownPost;
22-
use Illuminate\Support\Facades\Blade;
2321
use Illuminate\Support\ServiceProvider;
2422

2523
/**
@@ -76,38 +74,11 @@ public function register(): void
7674
*/
7775
public function boot(): void
7876
{
79-
$this->loadViewsFrom(__DIR__.'/../../resources/views', 'hyde');
8077

8178
$this->publishes([
8279
__DIR__.'/../../config' => config_path(),
8380
], 'configs');
8481

85-
$this->publishes([
86-
__DIR__.'/../../resources/views/layouts' => resource_path('views/vendor/hyde/layouts'),
87-
], 'hyde-layouts');
88-
89-
$this->publishes([
90-
__DIR__.'/../../resources/views/components' => resource_path('views/vendor/hyde/components'),
91-
], 'hyde-components');
92-
93-
$this->publishes([
94-
Hyde::vendorPath('resources/views/pages/404.blade.php') => Hyde::path('_pages/404.blade.php'),
95-
], 'hyde-page-404');
96-
97-
$this->publishes([
98-
Hyde::vendorPath('resources/views/homepages/welcome.blade.php') => Hyde::path('_pages/index.blade.php'),
99-
], 'hyde-welcome-page');
100-
101-
$this->publishes([
102-
Hyde::vendorPath('resources/views/homepages/post-feed.blade.php') => Hyde::path('_pages/index.blade.php'),
103-
], 'hyde-posts-page');
104-
105-
$this->publishes([
106-
Hyde::vendorPath('resources/views/homepages/blank.blade.php') => Hyde::path('_pages/index.blade.php'),
107-
], 'hyde-blank-page');
108-
109-
Blade::component('link', LinkComponent::class);
110-
11182
HydeKernel::getInstance()->readyToBoot();
11283
}
11384

0 commit comments

Comments
 (0)