1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Astrotomic\Stancy; |
4
|
|
|
|
5
|
|
|
use Astrotomic\Stancy\Contracts\FeedFactory as FeedFactoryContract; |
6
|
|
|
use Astrotomic\Stancy\Contracts\Page as PageContract; |
7
|
|
|
use Astrotomic\Stancy\Contracts\PageFactory as PageFactoryContract; |
8
|
|
|
use Astrotomic\Stancy\Contracts\SitemapFactory as SitemapFactoryContract; |
9
|
|
|
use Astrotomic\Stancy\Factories\FeedFactory; |
10
|
|
|
use Astrotomic\Stancy\Factories\PageFactory; |
11
|
|
|
use Astrotomic\Stancy\Factories\SitemapFactory; |
12
|
|
|
use Astrotomic\Stancy\Models\Page; |
13
|
|
|
use Illuminate\Contracts\Support\DeferrableProvider; |
14
|
|
|
use Illuminate\Support\ServiceProvider; |
15
|
|
|
|
16
|
|
|
class StancyServiceProvider extends ServiceProvider implements DeferrableProvider |
17
|
|
|
{ |
18
|
44 |
|
public function register(): void |
19
|
|
|
{ |
20
|
44 |
|
$this->registerPage(); |
21
|
44 |
|
$this->registerFeed(); |
22
|
44 |
|
$this->registerSitemap(); |
23
|
44 |
|
} |
24
|
|
|
|
25
|
1 |
|
public function provides(): array |
|
|
|
|
26
|
|
|
{ |
27
|
|
|
return [ |
28
|
1 |
|
PageFactoryContract::class, |
29
|
|
|
PageContract::class, |
30
|
|
|
FeedFactoryContract::class, |
31
|
|
|
SitemapFactoryContract::class, |
32
|
|
|
]; |
33
|
|
|
} |
34
|
|
|
|
35
|
44 |
|
protected function registerPage(): void |
36
|
|
|
{ |
37
|
44 |
|
$this->app->singleton(PageFactoryContract::class, PageFactory::class); |
38
|
44 |
|
$this->app->bind(PageContract::class, Page::class); |
39
|
44 |
|
} |
40
|
|
|
|
41
|
44 |
|
protected function registerFeed(): void |
42
|
|
|
{ |
43
|
44 |
|
$this->app->singleton(FeedFactoryContract::class, FeedFactory::class); |
44
|
44 |
|
} |
45
|
|
|
|
46
|
44 |
|
protected function registerSitemap(): void |
47
|
|
|
{ |
48
|
44 |
|
$this->app->singleton(SitemapFactoryContract::class, SitemapFactory::class); |
49
|
44 |
|
} |
50
|
|
|
} |
51
|
|
|
|