1
|
|
|
<?php namespace Arcanedev\SeoHelper; |
2
|
|
|
|
3
|
|
|
use Arcanedev\Support\Providers\PackageServiceProvider as ServiceProvider; |
4
|
|
|
use Illuminate\Contracts\Support\DeferrableProvider; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class SeoHelperServiceProvider |
8
|
|
|
* |
9
|
|
|
* @package Arcanedev\SeoHelper |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
*/ |
12
|
|
|
class SeoHelperServiceProvider extends ServiceProvider implements DeferrableProvider |
13
|
|
|
{ |
14
|
|
|
/* ----------------------------------------------------------------- |
15
|
|
|
| Properties |
16
|
|
|
| ----------------------------------------------------------------- |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Package name. |
21
|
|
|
* |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected $package = 'seo-helper'; |
25
|
|
|
|
26
|
|
|
/* ----------------------------------------------------------------- |
27
|
|
|
| Main Methods |
28
|
|
|
| ----------------------------------------------------------------- |
29
|
|
|
*/ |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Register the service provider. |
33
|
|
|
*/ |
34
|
298 |
|
public function register(): void |
35
|
|
|
{ |
36
|
298 |
|
parent::register(); |
37
|
|
|
|
38
|
298 |
|
$this->registerConfig(); |
39
|
|
|
|
40
|
298 |
|
$this->registerSeoHelperService(); |
41
|
298 |
|
$this->registerSeoMetaService(); |
42
|
298 |
|
$this->registerSeoOpenGraphService(); |
43
|
298 |
|
$this->registerSeoTwitterService(); |
44
|
298 |
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Boot the service provider. |
48
|
|
|
*/ |
49
|
298 |
|
public function boot(): void |
50
|
|
|
{ |
51
|
298 |
|
$this->publishConfig(); |
52
|
298 |
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Get the services provided by the provider. |
56
|
|
|
* |
57
|
|
|
* @return array |
58
|
|
|
*/ |
59
|
4 |
|
public function provides(): array |
60
|
|
|
{ |
61
|
|
|
return [ |
62
|
4 |
|
Contracts\SeoHelper::class, |
63
|
|
|
Contracts\SeoMeta::class, |
64
|
|
|
Contracts\SeoOpenGraph::class, |
65
|
|
|
Contracts\SeoTwitter::class, |
66
|
|
|
]; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/* ----------------------------------------------------------------- |
70
|
|
|
| Other Methods |
71
|
|
|
| ----------------------------------------------------------------- |
72
|
|
|
*/ |
73
|
|
|
/** |
74
|
|
|
* Register SeoHelper service. |
75
|
|
|
*/ |
76
|
298 |
|
private function registerSeoHelperService(): void |
77
|
|
|
{ |
78
|
298 |
|
$this->singleton(Contracts\SeoHelper::class, SeoHelper::class); |
79
|
298 |
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Register SeoMeta service. |
83
|
|
|
*/ |
84
|
298 |
|
private function registerSeoMetaService(): void |
85
|
|
|
{ |
86
|
|
|
$this->singleton(Contracts\SeoMeta::class, function ($app) { |
87
|
46 |
|
return new SeoMeta($app['config']->get('seo-helper')); |
88
|
298 |
|
}); |
89
|
298 |
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Register SeoOpenGraph service. |
93
|
|
|
*/ |
94
|
298 |
|
private function registerSeoOpenGraphService(): void |
95
|
|
|
{ |
96
|
|
|
$this->singleton(Contracts\SeoOpenGraph::class, function ($app) { |
97
|
44 |
|
return new SeoOpenGraph($app['config']->get('seo-helper')); |
98
|
298 |
|
}); |
99
|
298 |
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Register SeoTwitter service. |
103
|
|
|
*/ |
104
|
298 |
|
private function registerSeoTwitterService(): void |
105
|
|
|
{ |
106
|
|
|
$this->singleton(Contracts\SeoTwitter::class, function ($app) { |
107
|
44 |
|
return new SeoTwitter($app['config']->get('seo-helper')); |
108
|
298 |
|
}); |
109
|
298 |
|
} |
110
|
|
|
} |
111
|
|
|
|