@@ -6,7 +6,7 @@ |
||
6 | 6 | ]; |
7 | 7 | |
8 | 8 | foreach ($controllers as $key => $class) { |
9 | - $container[$key] = function ($container) use ($class) { |
|
9 | + $container[$key] = function($container) use ($class) { |
|
10 | 10 | return new $class($container); |
11 | 11 | }; |
12 | 12 | } |
@@ -12,31 +12,31 @@ discard block |
||
12 | 12 | * |
13 | 13 | * https://www.slimframework.com/docs/objects/router.html#route-strategies |
14 | 14 | */ |
15 | -$container['foundHandler'] = function () { |
|
15 | +$container['foundHandler'] = function() { |
|
16 | 16 | return new RequestResponseArgs(); |
17 | 17 | }; |
18 | 18 | |
19 | 19 | if ($container['env'] === 'prod') { |
20 | - $container['notFoundHandler'] = function ($container) { |
|
21 | - return function (Request $request, Response $response) use ($container) { |
|
20 | + $container['notFoundHandler'] = function($container) { |
|
21 | + return function(Request $request, Response $response) use ($container) { |
|
22 | 22 | return $response->withStatus(404)->write($container['view']->fetch('Error/404.twig')); |
23 | 23 | }; |
24 | 24 | }; |
25 | 25 | |
26 | - $container['notAllowedHandler'] = function ($container) { |
|
27 | - return function (Request $request, Response $response, array $methods) use ($container) { |
|
26 | + $container['notAllowedHandler'] = function($container) { |
|
27 | + return function(Request $request, Response $response, array $methods) use ($container) { |
|
28 | 28 | return $response->withStatus(405)->write($container['view']->fetch('Error/4xx.twig')); |
29 | 29 | }; |
30 | 30 | }; |
31 | 31 | |
32 | - $container['accessDeniedHandler'] = function ($container) { |
|
33 | - return function (Request $request, Response $response, Exception $exception) use ($container) { |
|
32 | + $container['accessDeniedHandler'] = function($container) { |
|
33 | + return function(Request $request, Response $response, Exception $exception) use ($container) { |
|
34 | 34 | return $response->withStatus(403)->write($container['view']->fetch('Error/403.twig')); |
35 | 35 | }; |
36 | 36 | }; |
37 | 37 | |
38 | - $container['errorHandler'] = function ($container) { |
|
39 | - return function (Request $request, Response $response, Exception $exception) use ($container) { |
|
38 | + $container['errorHandler'] = function($container) { |
|
39 | + return function(Request $request, Response $response, Exception $exception) use ($container) { |
|
40 | 40 | if ($exception instanceof AccessDeniedException) { |
41 | 41 | return $container['accessDeniedHandler']($request, $response, $exception); |
42 | 42 | } |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | }; |
46 | 46 | }; |
47 | 47 | |
48 | - $container['phpErrorHandler'] = function ($container) { |
|
49 | - return function (Request $request, Response $response, Throwable $error) use ($container) { |
|
48 | + $container['phpErrorHandler'] = function($container) { |
|
49 | + return function(Request $request, Response $response, Throwable $error) use ($container) { |
|
50 | 50 | return $response->withStatus(500)->write($container['view']->fetch('Error/500.twig')); |
51 | 51 | }; |
52 | 52 | }; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Security\Middleware\GuestMiddleware; |
4 | 4 | use Security\Middleware\AuthMiddleware; |
5 | 5 | |
6 | -$app->group('', function () { |
|
6 | +$app->group('', function() { |
|
7 | 7 | $this->map(['GET', 'POST'], '/login', 'auth.controller:login')->setName('login'); |
8 | 8 | $this->map(['GET', 'POST'], '/register', 'auth.controller:register')->setName('register'); |
9 | 9 | })->add(new GuestMiddleware($container)); |
@@ -21,25 +21,25 @@ discard block |
||
21 | 21 | $capsule->setAsGlobal(); |
22 | 22 | $capsule->bootEloquent(); |
23 | 23 | |
24 | -$container['db'] = function () use ($capsule) { |
|
24 | +$container['db'] = function() use ($capsule) { |
|
25 | 25 | return $capsule; |
26 | 26 | }; |
27 | 27 | |
28 | -$container['auth'] = function () { |
|
28 | +$container['auth'] = function() { |
|
29 | 29 | $sentinel = new Sentinel(new SentinelBootstrapper(__DIR__ . '/config/sentinel.php')); |
30 | 30 | |
31 | 31 | return $sentinel->getSentinel(); |
32 | 32 | }; |
33 | 33 | |
34 | -$container['flash'] = function () { |
|
34 | +$container['flash'] = function() { |
|
35 | 35 | return new Messages(); |
36 | 36 | }; |
37 | 37 | |
38 | -$container['validator'] = function () { |
|
38 | +$container['validator'] = function() { |
|
39 | 39 | return new Validator(); |
40 | 40 | }; |
41 | 41 | |
42 | -$container['view'] = function ($container) { |
|
42 | +$container['view'] = function($container) { |
|
43 | 43 | $config = $container['config']; |
44 | 44 | |
45 | 45 | $view = new Twig( |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return $view; |
65 | 65 | }; |
66 | 66 | |
67 | -$container['monolog'] = function ($container) { |
|
67 | +$container['monolog'] = function($container) { |
|
68 | 68 | $config = $container['config']['monolog']; |
69 | 69 | |
70 | 70 | $logger = new Logger($config['name']); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | $sentinel = (new Sentinel(new SentinelBootstrapper(__DIR__ . '/../config/sentinel.php')))->getSentinel(); |
9 | 9 | |
10 | -Manager::schema()->create('user', function (Blueprint $table) { |
|
10 | +Manager::schema()->create('user', function(Blueprint $table) { |
|
11 | 11 | $table->increments('id'); |
12 | 12 | $table->string('username')->unique(); |
13 | 13 | $table->string('email')->unique(); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $table->timestamps(); |
20 | 20 | }); |
21 | 21 | |
22 | -Manager::schema()->create('activations', function (Blueprint $table) { |
|
22 | +Manager::schema()->create('activations', function(Blueprint $table) { |
|
23 | 23 | $table->increments('id'); |
24 | 24 | $table->unsignedInteger('user_id'); |
25 | 25 | $table->string('code'); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $table->foreign('user_id')->references('id')->on('user'); |
30 | 30 | }); |
31 | 31 | |
32 | -Manager::schema()->create('persistences', function (Blueprint $table) { |
|
32 | +Manager::schema()->create('persistences', function(Blueprint $table) { |
|
33 | 33 | $table->increments('id'); |
34 | 34 | $table->unsignedInteger('user_id'); |
35 | 35 | $table->string('code')->unique(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $table->foreign('user_id')->references('id')->on('user'); |
38 | 38 | }); |
39 | 39 | |
40 | -Manager::schema()->create('reminders', function (Blueprint $table) { |
|
40 | +Manager::schema()->create('reminders', function(Blueprint $table) { |
|
41 | 41 | $table->increments('id'); |
42 | 42 | $table->unsignedInteger('user_id'); |
43 | 43 | $table->string('code'); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $table->foreign('user_id')->references('id')->on('user'); |
48 | 48 | }); |
49 | 49 | |
50 | -Manager::schema()->create('roles', function (Blueprint $table) { |
|
50 | +Manager::schema()->create('roles', function(Blueprint $table) { |
|
51 | 51 | $table->increments('id'); |
52 | 52 | $table->string('slug')->unique(); |
53 | 53 | $table->string('name'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $table->timestamps(); |
56 | 56 | }); |
57 | 57 | |
58 | -Manager::schema()->create('role_users', function (Blueprint $table) { |
|
58 | +Manager::schema()->create('role_users', function(Blueprint $table) { |
|
59 | 59 | $table->unsignedInteger('user_id'); |
60 | 60 | $table->unsignedInteger('role_id'); |
61 | 61 | $table->timestamps(); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $table->foreign('role_id')->references('id')->on('roles'); |
65 | 65 | }); |
66 | 66 | |
67 | -Manager::schema()->create('throttle', function (Blueprint $table) { |
|
67 | +Manager::schema()->create('throttle', function(Blueprint $table) { |
|
68 | 68 | $table->increments('id'); |
69 | 69 | $table->integer('user_id')->unsigned()->nullable(); |
70 | 70 | $table->string('type'); |