1
|
|
|
<?php namespace Anomaly\Streams\Platform; |
2
|
|
|
|
3
|
|
|
use Anomaly\Streams\Platform\Addon\AddonManager; |
4
|
|
|
use Anomaly\Streams\Platform\Application\Command\ConfigureCommandBus; |
5
|
|
|
use Anomaly\Streams\Platform\Application\Command\ConfigureTranslator; |
6
|
|
|
use Anomaly\Streams\Platform\Application\Command\ConfigureUriValidator; |
7
|
|
|
use Anomaly\Streams\Platform\Application\Command\InitializeApplication; |
8
|
|
|
use Anomaly\Streams\Platform\Application\Command\LoadEnvironmentOverrides; |
9
|
|
|
use Anomaly\Streams\Platform\Application\Command\LoadStreamsConfiguration; |
10
|
|
|
use Anomaly\Streams\Platform\Application\Command\SetCoreConnection; |
11
|
|
|
use Anomaly\Streams\Platform\Asset\Command\AddAssetNamespaces; |
12
|
|
|
use Anomaly\Streams\Platform\Assignment\AssignmentModel; |
13
|
|
|
use Anomaly\Streams\Platform\Assignment\AssignmentObserver; |
14
|
|
|
use Anomaly\Streams\Platform\Entry\Command\AutoloadEntryModels; |
15
|
|
|
use Anomaly\Streams\Platform\Entry\EntryModel; |
16
|
|
|
use Anomaly\Streams\Platform\Entry\EntryObserver; |
17
|
|
|
use Anomaly\Streams\Platform\Event\Booted; |
18
|
|
|
use Anomaly\Streams\Platform\Event\Booting; |
19
|
|
|
use Anomaly\Streams\Platform\Event\Ready; |
20
|
|
|
use Anomaly\Streams\Platform\Field\FieldModel; |
21
|
|
|
use Anomaly\Streams\Platform\Field\FieldObserver; |
22
|
|
|
use Anomaly\Streams\Platform\Image\Command\AddImageNamespaces; |
23
|
|
|
use Anomaly\Streams\Platform\Mail\Command\RegisterMailer; |
24
|
|
|
use Anomaly\Streams\Platform\Model\EloquentModel; |
25
|
|
|
use Anomaly\Streams\Platform\Model\EloquentObserver; |
26
|
|
|
use Anomaly\Streams\Platform\Routing\Command\IncludeRoutes; |
27
|
|
|
use Anomaly\Streams\Platform\Stream\StreamModel; |
28
|
|
|
use Anomaly\Streams\Platform\Stream\StreamObserver; |
29
|
|
|
use Anomaly\Streams\Platform\View\Cache\CacheAdapter; |
30
|
|
|
use Anomaly\Streams\Platform\View\Cache\CacheKey; |
31
|
|
|
use Anomaly\Streams\Platform\View\Cache\CacheStrategy; |
32
|
|
|
use Anomaly\Streams\Platform\View\Command\AddViewNamespaces; |
33
|
|
|
use Anomaly\Streams\Platform\View\Event\RegisteringTwigPlugins; |
34
|
|
|
use Aptoma\Twig\Extension\MarkdownEngine\MichelfMarkdownEngine; |
35
|
|
|
use Aptoma\Twig\Extension\MarkdownExtension; |
36
|
|
|
use Asm89\Twig\CacheExtension\Extension; |
37
|
|
|
use Illuminate\Console\Scheduling\Schedule; |
38
|
|
|
use Illuminate\Contracts\Cache\Repository; |
39
|
|
|
use Illuminate\Contracts\Events\Dispatcher; |
40
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs; |
41
|
|
|
use Illuminate\Routing\Redirector; |
42
|
|
|
use Illuminate\Support\ServiceProvider; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Class StreamsServiceProvider |
46
|
|
|
* |
47
|
|
|
* In order to consolidate service providers throughout the |
48
|
|
|
* Streams Platform, we do all of our bootstrapping here. |
49
|
|
|
* |
50
|
|
|
* @link http://anomaly.is/streams-platform |
51
|
|
|
* @author AnomalyLabs, Inc. <[email protected]> |
52
|
|
|
* @author Ryan Thompson <[email protected]> |
53
|
|
|
* @package Anomaly\Streams\Platform |
54
|
|
|
*/ |
55
|
|
|
class StreamsServiceProvider extends ServiceProvider |
56
|
|
|
{ |
57
|
|
|
|
58
|
|
|
use DispatchesJobs; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* The scheduled commands. |
62
|
|
|
* |
63
|
|
|
* @var array |
64
|
|
|
*/ |
65
|
|
|
protected $schedule = []; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* The providers to register. |
69
|
|
|
* |
70
|
|
|
* @var array |
71
|
|
|
*/ |
72
|
|
|
protected $providers = [ |
73
|
|
|
'Anomaly\Streams\Platform\StreamsConsoleProvider', |
74
|
|
|
'Anomaly\Streams\Platform\StreamsEventProvider', |
75
|
|
|
]; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* The plugins to register. |
79
|
|
|
* |
80
|
|
|
* @var array |
81
|
|
|
*/ |
82
|
|
|
protected $plugins = [ |
83
|
|
|
'TwigBridge\Extension\Laravel\Form', |
84
|
|
|
'TwigBridge\Extension\Laravel\Html', |
85
|
|
|
'Anomaly\Streams\Platform\StreamsPlugin', |
86
|
|
|
'Phive\Twig\Extensions\Deferred\DeferredExtension' |
87
|
|
|
]; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* The commands to register. |
91
|
|
|
* |
92
|
|
|
* @var array |
93
|
|
|
*/ |
94
|
|
|
protected $commands = [ |
95
|
|
|
'Anomaly\Streams\Platform\Asset\Console\Clear', |
96
|
|
|
'Anomaly\Streams\Platform\Stream\Console\Make', |
97
|
|
|
'Anomaly\Streams\Platform\Stream\Console\Compile', |
98
|
|
|
'Anomaly\Streams\Platform\Stream\Console\Refresh', |
99
|
|
|
'Anomaly\Streams\Platform\Stream\Console\Cleanup', |
100
|
|
|
'Anomaly\Streams\Platform\Stream\Console\Destroy', |
101
|
|
|
'Anomaly\Streams\Platform\Addon\Console\MakeAddon', |
102
|
|
|
'Anomaly\Streams\Platform\Addon\Module\Console\Install', |
103
|
|
|
'Anomaly\Streams\Platform\Addon\Module\Console\Uninstall', |
104
|
|
|
'Anomaly\Streams\Platform\Addon\Module\Console\Reinstall', |
105
|
|
|
'Anomaly\Streams\Platform\Addon\Extension\Console\Install', |
106
|
|
|
'Anomaly\Streams\Platform\Addon\Extension\Console\Uninstall', |
107
|
|
|
'Anomaly\Streams\Platform\Addon\Extension\Console\Reinstall', |
108
|
|
|
'Anomaly\Streams\Platform\Installer\Console\Install', |
109
|
|
|
'Anomaly\Streams\Platform\Application\Console\EnvSet', |
110
|
|
|
]; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* The class bindings. |
114
|
|
|
* |
115
|
|
|
* @var array |
116
|
|
|
*/ |
117
|
|
|
protected $bindings = [ |
118
|
|
|
'Illuminate\Contracts\Debug\ExceptionHandler' => 'Anomaly\Streams\Platform\Exception\ExceptionHandler', |
119
|
|
|
'Illuminate\Routing\UrlGenerator' => 'Anomaly\Streams\Platform\Routing\UrlGenerator', |
120
|
|
|
'Illuminate\Contracts\Routing\UrlGenerator' => 'Anomaly\Streams\Platform\Routing\UrlGenerator', |
121
|
|
|
'Anomaly\Streams\Platform\Entry\EntryModel' => 'Anomaly\Streams\Platform\Entry\EntryModel', |
122
|
|
|
'Anomaly\Streams\Platform\Entry\Contract\EntryRepositoryInterface' => 'Anomaly\Streams\Platform\Entry\EntryRepository', |
123
|
|
|
'Anomaly\Streams\Platform\Field\FieldModel' => 'Anomaly\Streams\Platform\Field\FieldModel', |
124
|
|
|
'Anomaly\Streams\Platform\Field\Contract\FieldRepositoryInterface' => 'Anomaly\Streams\Platform\Field\FieldRepository', |
125
|
|
|
'Anomaly\Streams\Platform\Stream\StreamModel' => 'Anomaly\Streams\Platform\Stream\StreamModel', |
126
|
|
|
'Anomaly\Streams\Platform\Stream\Contract\StreamRepositoryInterface' => 'Anomaly\Streams\Platform\Stream\StreamRepository', |
127
|
|
|
'Anomaly\Streams\Platform\Model\Contract\EloquentRepositoryInterface' => 'Anomaly\Streams\Platform\Model\EloquentRepository', |
128
|
|
|
'Anomaly\Streams\Platform\Assignment\AssignmentModel' => 'Anomaly\Streams\Platform\Assignment\AssignmentModel', |
129
|
|
|
'Anomaly\Streams\Platform\Assignment\Contract\AssignmentRepositoryInterface' => 'Anomaly\Streams\Platform\Assignment\AssignmentRepository', |
130
|
|
|
'Anomaly\Streams\Platform\Addon\Module\ModuleModel' => 'Anomaly\Streams\Platform\Addon\Module\ModuleModel', |
131
|
|
|
'Anomaly\Streams\Platform\Addon\Module\Contract\ModuleRepositoryInterface' => 'Anomaly\Streams\Platform\Addon\Module\ModuleRepository', |
132
|
|
|
'Anomaly\Streams\Platform\Addon\Extension\ExtensionModel' => 'Anomaly\Streams\Platform\Addon\Extension\ExtensionModel', |
133
|
|
|
'Anomaly\Streams\Platform\Addon\Extension\Contract\ExtensionRepositoryInterface' => 'Anomaly\Streams\Platform\Addon\Extension\ExtensionRepository', |
134
|
|
|
'addon.collection' => 'Anomaly\Streams\Platform\Addon\AddonCollection', |
135
|
|
|
'module.collection' => 'Anomaly\Streams\Platform\Addon\Module\ModuleCollection', |
136
|
|
|
'extension.collection' => 'Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection', |
137
|
|
|
'field_type.collection' => 'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeCollection', |
138
|
|
|
'plugin.collection' => 'Anomaly\Streams\Platform\Addon\Plugin\PluginCollection', |
139
|
|
|
'theme.collection' => 'Anomaly\Streams\Platform\Addon\Theme\ThemeCollection' |
140
|
|
|
]; |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* The singleton bindings. |
144
|
|
|
* |
145
|
|
|
* @var array |
146
|
|
|
*/ |
147
|
|
|
protected $singletons = [ |
148
|
|
|
'Illuminate\Contracts\Routing\UrlGenerator' => 'Anomaly\Streams\Platform\Routing\UrlGenerator', |
149
|
|
|
'Intervention\Image\ImageManager' => 'image', |
150
|
|
|
'League\Flysystem\MountManager' => 'League\Flysystem\MountManager', |
151
|
|
|
'Illuminate\Console\Scheduling\Schedule' => 'Illuminate\Console\Scheduling\Schedule', |
152
|
|
|
'Anomaly\Streams\Platform\Application\Application' => 'Anomaly\Streams\Platform\Application\Application', |
153
|
|
|
'Anomaly\Streams\Platform\Addon\AddonLoader' => 'Anomaly\Streams\Platform\Addon\AddonLoader', |
154
|
|
|
'Anomaly\Streams\Platform\Addon\AddonBinder' => 'Anomaly\Streams\Platform\Addon\AddonBinder', |
155
|
|
|
'Anomaly\Streams\Platform\Addon\AddonManager' => 'Anomaly\Streams\Platform\Addon\AddonManager', |
156
|
|
|
'Anomaly\Streams\Platform\Addon\AddonCollection' => 'Anomaly\Streams\Platform\Addon\AddonCollection', |
157
|
|
|
'Anomaly\Streams\Platform\Message\MessageBag' => 'Anomaly\Streams\Platform\Message\MessageBag', |
158
|
|
|
'Anomaly\Streams\Platform\Stream\StreamStore' => 'Anomaly\Streams\Platform\Stream\StreamStore', |
159
|
|
|
'Anomaly\Streams\Platform\Support\Configurator' => 'Anomaly\Streams\Platform\Support\Configurator', |
160
|
|
|
'Anomaly\Streams\Platform\Support\Authorizer' => 'Anomaly\Streams\Platform\Support\Authorizer', |
161
|
|
|
'Anomaly\Streams\Platform\Support\Evaluator' => 'Anomaly\Streams\Platform\Support\Evaluator', |
162
|
|
|
'Anomaly\Streams\Platform\Support\Parser' => 'Anomaly\Streams\Platform\Support\Parser', |
163
|
|
|
'Anomaly\Streams\Platform\Support\Hydrator' => 'Anomaly\Streams\Platform\Support\Hydrator', |
164
|
|
|
'Anomaly\Streams\Platform\Support\Resolver' => 'Anomaly\Streams\Platform\Support\Resolver', |
165
|
|
|
'Anomaly\Streams\Platform\Support\Translator' => 'Anomaly\Streams\Platform\Support\Translator', |
166
|
|
|
'Anomaly\Streams\Platform\Asset\Asset' => 'Anomaly\Streams\Platform\Asset\Asset', |
167
|
|
|
'Anomaly\Streams\Platform\Asset\AssetPaths' => 'Anomaly\Streams\Platform\Asset\AssetPaths', |
168
|
|
|
'Anomaly\Streams\Platform\Asset\AssetParser' => 'Anomaly\Streams\Platform\Asset\AssetParser', |
169
|
|
|
'Anomaly\Streams\Platform\Image\Image' => 'Anomaly\Streams\Platform\Image\Image', |
170
|
|
|
'Anomaly\Streams\Platform\Image\ImagePaths' => 'Anomaly\Streams\Platform\Image\ImagePaths', |
171
|
|
|
'Anomaly\Streams\Platform\Image\ImageMacros' => 'Anomaly\Streams\Platform\Image\ImageMacros', |
172
|
|
|
'Anomaly\Streams\Platform\Ui\Table\Component\View\ViewRegistry' => 'Anomaly\Streams\Platform\Ui\Table\Component\View\ViewRegistry', |
173
|
|
|
'Anomaly\Streams\Platform\Ui\Table\Component\Filter\FilterRegistry' => 'Anomaly\Streams\Platform\Ui\Table\Component\Filter\FilterRegistry', |
174
|
|
|
'Anomaly\Streams\Platform\Ui\Breadcrumb\BreadcrumbCollection' => 'Anomaly\Streams\Platform\Ui\Breadcrumb\BreadcrumbCollection', |
175
|
|
|
'Anomaly\Streams\Platform\Ui\Icon\IconRegistry' => 'Anomaly\Streams\Platform\Ui\Icon\IconRegistry', |
176
|
|
|
'Anomaly\Streams\Platform\Ui\Button\ButtonRegistry' => 'Anomaly\Streams\Platform\Ui\Button\ButtonRegistry', |
177
|
|
|
'Anomaly\Streams\Platform\Ui\ControlPanel\Component\Section\SectionCollection' => 'Anomaly\Streams\Platform\Ui\ControlPanel\Component\Section\SectionCollection', |
178
|
|
|
'Anomaly\Streams\Platform\Ui\ControlPanel\Component\Navigation\NavigationCollection' => 'Anomaly\Streams\Platform\Ui\ControlPanel\Component\Navigation\NavigationCollection', |
179
|
|
|
'Anomaly\Streams\Platform\Http\Middleware\MiddlewareCollection' => 'Anomaly\Streams\Platform\Http\Middleware\MiddlewareCollection', |
180
|
|
|
'Anomaly\Streams\Platform\Stream\StreamModel' => 'Anomaly\Streams\Platform\Stream\StreamModel', |
181
|
|
|
'Anomaly\Streams\Platform\Addon\Module\ModuleCollection' => 'Anomaly\Streams\Platform\Addon\Module\ModuleCollection', |
182
|
|
|
'Anomaly\Streams\Platform\Addon\Module\Listener\PutModuleInCollection' => 'Anomaly\Streams\Platform\Addon\Module\Listener\PutModuleInCollection', |
183
|
|
|
'Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection' => 'Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection', |
184
|
|
|
'Anomaly\Streams\Platform\Addon\Extension\Listener\PutExtensionInCollection' => 'Anomaly\Streams\Platform\Addon\Extension\Listener\PutExtensionInCollection', |
185
|
|
|
'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeModifier' => 'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeModifier', |
186
|
|
|
'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeCollection' => 'Anomaly\Streams\Platform\Addon\FieldType\FieldTypeCollection', |
187
|
|
|
'Anomaly\Streams\Platform\Addon\FieldType\Listener\PutFieldTypeInCollection' => 'Anomaly\Streams\Platform\Addon\FieldType\Listener\PutFieldTypeInCollection', |
188
|
|
|
'Anomaly\Streams\Platform\Addon\Plugin\PluginCollection' => 'Anomaly\Streams\Platform\Addon\Plugin\PluginCollection', |
189
|
|
|
'Anomaly\Streams\Platform\Addon\Plugin\Listener\PutPluginInCollection' => 'Anomaly\Streams\Platform\Addon\Plugin\Listener\PutPluginInCollection', |
190
|
|
|
'Anomaly\Streams\Platform\Addon\Theme\ThemeCollection' => 'Anomaly\Streams\Platform\Addon\Theme\ThemeCollection', |
191
|
|
|
'Anomaly\Streams\Platform\Addon\Theme\Listener\PutThemeInCollection' => 'Anomaly\Streams\Platform\Addon\Theme\Listener\PutThemeInCollection', |
192
|
|
|
'Anomaly\Streams\Platform\View\ViewComposer' => 'Anomaly\Streams\Platform\View\ViewComposer', |
193
|
|
|
'Anomaly\Streams\Platform\View\ViewTemplate' => 'Anomaly\Streams\Platform\View\ViewTemplate', |
194
|
|
|
'Anomaly\Streams\Platform\View\ViewOverrides' => 'Anomaly\Streams\Platform\View\ViewOverrides', |
195
|
|
|
'Anomaly\Streams\Platform\View\ViewMobileOverrides' => 'Anomaly\Streams\Platform\View\ViewMobileOverrides', |
196
|
|
|
'Anomaly\Streams\Platform\View\Listener\LoadTemplateData' => 'Anomaly\Streams\Platform\View\Listener\LoadTemplateData', |
197
|
|
|
'Anomaly\Streams\Platform\View\Listener\DecorateData' => 'Anomaly\Streams\Platform\View\Listener\DecorateData', |
198
|
|
|
'Anomaly\Streams\Platform\Support\Template' => 'Anomaly\Streams\Platform\Support\Template' |
199
|
|
|
]; |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* Boot the service provider. |
203
|
|
|
*/ |
204
|
|
|
public function boot(Dispatcher $events) |
205
|
|
|
{ |
206
|
|
|
$events->fire(new Booting()); |
207
|
|
|
|
208
|
|
|
// First load our app environment. |
209
|
|
|
$this->dispatch(new LoadEnvironmentOverrides()); |
210
|
|
|
|
211
|
|
|
// Next take care of core utilities. |
212
|
|
|
$this->dispatch(new SetCoreConnection()); |
213
|
|
|
$this->dispatch(new ConfigureCommandBus()); |
214
|
|
|
$this->dispatch(new ConfigureUriValidator()); |
215
|
|
|
$this->dispatch(new InitializeApplication()); |
216
|
|
|
|
217
|
|
|
// Setup and preparing utilities. |
218
|
|
|
$this->dispatch(new LoadStreamsConfiguration()); |
219
|
|
|
$this->dispatch(new AutoloadEntryModels()); |
220
|
|
|
$this->dispatch(new AddAssetNamespaces()); |
221
|
|
|
$this->dispatch(new AddImageNamespaces()); |
222
|
|
|
$this->dispatch(new AddViewNamespaces()); |
223
|
|
|
$this->dispatch(new RegisterMailer()); |
224
|
|
|
|
225
|
|
|
// Observe our base models. |
226
|
|
|
EntryModel::observe(EntryObserver::class); |
227
|
|
|
FieldModel::observe(FieldObserver::class); |
228
|
|
|
StreamModel::observe(StreamObserver::class); |
229
|
|
|
EloquentModel::observe(EloquentObserver::class); |
230
|
|
|
AssignmentModel::observe(AssignmentObserver::class); |
231
|
|
|
|
232
|
|
|
$this->app->booted( |
233
|
|
|
function () use ($events) { |
234
|
|
|
|
235
|
|
|
$events->fire(new Booted()); |
236
|
|
|
|
237
|
|
|
/* @var AddonManager $manager */ |
238
|
|
|
$manager = $this->app->make('Anomaly\Streams\Platform\Addon\AddonManager'); |
239
|
|
|
|
240
|
|
|
/* @var Dispatcher $events */ |
241
|
|
|
$events = $this->app->make('Illuminate\Contracts\Events\Dispatcher'); |
|
|
|
|
242
|
|
|
|
243
|
|
|
$events->listen( |
244
|
|
|
'Anomaly\Streams\Platform\View\Event\RegisteringTwigPlugins', |
245
|
|
|
function (RegisteringTwigPlugins $event) { |
246
|
|
|
|
247
|
|
|
$twig = $event->getTwig(); |
248
|
|
|
|
249
|
|
|
foreach ($this->plugins as $plugin) { |
250
|
|
|
if (!$twig->hasExtension($plugin)) { |
251
|
|
|
$twig->addExtension($this->app->make($plugin)); |
252
|
|
|
} |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
if (!$twig->hasExtension('markdown')) { |
256
|
|
|
$twig->addExtension(new MarkdownExtension(new MichelfMarkdownEngine())); |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
$twig->addExtension( |
260
|
|
|
new Extension( |
261
|
|
|
new CacheStrategy( |
262
|
|
|
new CacheAdapter($this->app->make(Repository::class)), new CacheKey() |
263
|
|
|
) |
264
|
|
|
) |
265
|
|
|
); |
266
|
|
|
} |
267
|
|
|
); |
268
|
|
|
|
269
|
|
|
$manager->register(); |
270
|
|
|
|
271
|
|
|
$this->dispatch(new IncludeRoutes()); |
272
|
|
|
|
273
|
|
|
$events->fire(new Ready()); |
274
|
|
|
} |
275
|
|
|
); |
276
|
|
|
|
277
|
|
|
$this->dispatch(new ConfigureTranslator()); |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Register the service provider. |
282
|
|
|
* |
283
|
|
|
* @return void |
284
|
|
|
*/ |
285
|
|
|
public function register() |
286
|
|
|
{ |
287
|
|
|
/** |
288
|
|
|
* Register all third party packages first. |
289
|
|
|
*/ |
290
|
|
|
$this->app->register('TwigBridge\ServiceProvider'); |
291
|
|
|
$this->app->register('Barryvdh\HttpCache\ServiceProvider'); |
292
|
|
|
$this->app->register('Collective\Html\HtmlServiceProvider'); |
293
|
|
|
$this->app->register('Intervention\Image\ImageServiceProvider'); |
294
|
|
|
|
295
|
|
|
if (env('APP_DEBUG')) { |
296
|
|
|
$this->app->register('Barryvdh\Debugbar\ServiceProvider'); |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
// Register bindings. |
300
|
|
|
foreach (array_merge($this->bindings, config('streams.bindings', [])) as $abstract => $concrete) { |
301
|
|
|
$this->app->bind($abstract, $concrete); |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
// Register singletons. |
305
|
|
|
foreach (array_merge($this->singletons, config('streams.singletons', [])) as $abstract => $concrete) { |
306
|
|
|
$this->app->singleton($abstract, $concrete); |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
// Register streams other providers. |
310
|
|
|
foreach (array_merge($this->providers, config('streams.providers', [])) as $provider) { |
311
|
|
|
$this->app->register($provider); |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
// Register commands. |
315
|
|
|
$this->commands(array_merge($this->commands, config('streams.commands', []))); |
316
|
|
|
|
317
|
|
|
/* @var Schedule $schedule */ |
318
|
|
|
$schedule = $this->app->make(Schedule::class); |
319
|
|
|
|
320
|
|
|
foreach (array_merge($this->schedule, config('streams.schedule', [])) as $frequency => $commands) { |
321
|
|
|
foreach (array_filter($commands) as $command) { |
322
|
|
|
if (str_contains($frequency, ' ')) { |
323
|
|
|
$schedule->command($command)->cron($frequency); |
324
|
|
|
} else { |
325
|
|
|
$schedule->command($command)->{camel_case($frequency)}(); |
326
|
|
|
} |
327
|
|
|
} |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* Change the default language path so |
332
|
|
|
* that there MUST be a prefix hint. |
333
|
|
|
*/ |
334
|
|
|
$this->app->singleton( |
335
|
|
|
'path.lang', |
336
|
|
|
function () { |
337
|
|
|
return realpath(__DIR__ . '/../resources/lang'); |
338
|
|
|
} |
339
|
|
|
); |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* Register the path to the streams platform. |
343
|
|
|
* This is handy for helping load other streams things. |
344
|
|
|
*/ |
345
|
|
|
$this->app->instance( |
346
|
|
|
'streams.path', |
347
|
|
|
$this->app->make('path.base') . '/vendor/anomaly/streams-platform' |
348
|
|
|
); |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* If we don't have an .env file we need to head |
352
|
|
|
* to the installer (unless that's where we're at). |
353
|
|
|
*/ |
354
|
|
|
if (!env('INSTALLED') && $this->app->make('request')->segment(1) !== 'installer') { |
355
|
|
|
|
356
|
|
|
$this->app->make('router')->any( |
357
|
|
|
'{url?}', |
358
|
|
|
function (Redirector $redirector) { |
359
|
|
|
return $redirector->to('installer'); |
360
|
|
|
} |
361
|
|
|
)->where(['url' => '(.*)']); |
362
|
|
|
|
363
|
|
|
return; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* Register system routes. |
368
|
|
|
*/ |
369
|
|
|
$this->app->make('router')->post( |
370
|
|
|
'form/handle/{key}', |
371
|
|
|
'Anomaly\Streams\Platform\Http\Controller\FormController@handle' |
372
|
|
|
); |
373
|
|
|
|
374
|
|
|
$this->app->make('router')->get( |
375
|
|
|
'entry/handle/restore/{addon}/{namespace}/{stream}/{id}', |
376
|
|
|
'Anomaly\Streams\Platform\Http\Controller\EntryController@restore' |
377
|
|
|
); |
378
|
|
|
|
379
|
|
|
$this->app->make('router')->get( |
380
|
|
|
'entry/handle/export/{addon}/{namespace}/{stream}', |
381
|
|
|
'Anomaly\Streams\Platform\Http\Controller\EntryController@export' |
382
|
|
|
); |
383
|
|
|
} |
384
|
|
|
} |
385
|
|
|
|
It seems like you are assigning to a variable which was imported through a
use
statement which was not imported by reference.For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.
Change not visible in outer-scope
Change visible in outer-scope