-
-
Notifications
You must be signed in to change notification settings - Fork 829
/
InstallServiceProvider.php
47 lines (39 loc) · 1.25 KB
/
InstallServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Install;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Http\RouteCollection;
use Flarum\Http\RouteHandlerFactory;
use Illuminate\Contracts\Container\Container;
class InstallServiceProvider extends AbstractServiceProvider
{
public function register(): void
{
$this->container->singleton('flarum.install.routes', function () {
return new RouteCollection;
});
}
public function boot(Container $container, RouteHandlerFactory $route): void
{
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.install');
$this->populateRoutes($container->make('flarum.install.routes'), $route);
}
protected function populateRoutes(RouteCollection $routes, RouteHandlerFactory $route): void
{
$routes->get(
'/{path:.*}',
'index',
$route->toController(Controller\IndexController::class)
);
$routes->post(
'/{path:.*}',
'install',
$route->toController(Controller\InstallController::class)
);
}
}