1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Digia\Lumen\ContentfulSync\Providers; |
4
|
|
|
|
5
|
|
|
use Digia\Lumen\ContentfulSync\Console\Commands\SyncAssetsCommand; |
6
|
|
|
use Digia\Lumen\ContentfulSync\Console\Commands\SyncContentsCommand; |
7
|
|
|
use Digia\Lumen\ContentfulSync\Contracts\ContentfulSyncServiceContract; |
8
|
|
|
use Illuminate\Support\ServiceProvider; |
9
|
|
|
use Jalle19\Laravel\LostInterfaces\Providers\ServiceProvider as ServiceProviderInterface; |
10
|
|
|
use Laravel\Lumen\Application; |
11
|
|
|
use Nord\Lumen\Contentful\ContentfulServiceContract; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class AbstractContentfulSyncServiceProvider |
15
|
|
|
* @package Digia\Lumen\ContentfulSync\Providers |
16
|
|
|
*/ |
17
|
|
|
abstract class AbstractContentfulSyncServiceProvider extends ServiceProvider implements ServiceProviderInterface |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @param Application $app |
22
|
|
|
*/ |
23
|
|
|
abstract protected function registerContentfulSyncServiceBindings(Application $app); |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @inheritDoc |
27
|
|
|
*/ |
28
|
|
|
public function register() |
29
|
|
|
{ |
30
|
|
|
app()->configure('contentfulSync'); |
31
|
|
|
|
32
|
|
|
// Configure how ContentfulSyncServiceContract should be built |
33
|
|
|
$this->registerContentfulSyncServiceBindings(app()); |
34
|
|
|
|
35
|
|
|
// Configure how commands should be built |
36
|
|
|
app()->bind(SyncAssetsCommand::class, function (Application $app) { |
37
|
|
|
return new SyncAssetsCommand(config('contentfulSync.content_types'), |
38
|
|
|
$app->make(ContentfulServiceContract::class), |
39
|
|
|
$app->make(ContentfulSyncServiceContract::class)); |
40
|
|
|
}); |
41
|
|
|
|
42
|
|
|
app()->bind(SyncContentsCommand::class, function (Application $app) { |
43
|
|
|
return new SyncContentsCommand(config('contentfulSync.content_types'), |
44
|
|
|
$app->make(ContentfulServiceContract::class), |
45
|
|
|
$app->make(ContentfulSyncServiceContract::class)); |
46
|
|
|
}); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @inheritDoc |
51
|
|
|
*/ |
52
|
|
|
public function boot() |
53
|
|
|
{ |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|