@@ -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 | } |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | $capsule->setAsGlobal(); |
24 | 24 | $capsule->bootEloquent(); |
25 | 25 | |
26 | -$container['db'] = function () use ($capsule) { |
|
26 | +$container['db'] = function() use ($capsule) { |
|
27 | 27 | return $capsule; |
28 | 28 | }; |
29 | 29 | |
30 | -$container['auth'] = function () { |
|
30 | +$container['auth'] = function() { |
|
31 | 31 | $sentinel = new Sentinel(new SentinelBootstrapper(__DIR__ . '/sentinel.php')); |
32 | 32 | |
33 | 33 | return $sentinel->getSentinel(); |
34 | 34 | }; |
35 | 35 | |
36 | -$container['flash'] = function () { |
|
36 | +$container['flash'] = function() { |
|
37 | 37 | return new Messages(); |
38 | 38 | }; |
39 | 39 | |
40 | -$container['validator'] = function () { |
|
40 | +$container['validator'] = function() { |
|
41 | 41 | return new Validator(); |
42 | 42 | }; |
43 | 43 | |
44 | -$container['view'] = function ($container) { |
|
44 | +$container['view'] = function($container) { |
|
45 | 45 | $settings = $container['settings']; |
46 | 46 | |
47 | 47 | $view = new Twig( |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | return $view; |
67 | 67 | }; |
68 | 68 | |
69 | -$container['monolog'] = function ($container) { |
|
69 | +$container['monolog'] = function($container) { |
|
70 | 70 | $settings = $container['settings']['monolog']; |
71 | 71 | |
72 | 72 | $logger = new Logger($settings['name']); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | Manager::schema()->dropIfExists($table); |
22 | 22 | } |
23 | 23 | |
24 | -Manager::schema()->create('user', function (Blueprint $table) { |
|
24 | +Manager::schema()->create('user', function(Blueprint $table) { |
|
25 | 25 | $table->increments('id'); |
26 | 26 | $table->string('username')->unique(); |
27 | 27 | $table->string('email')->unique(); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $table->timestamps(); |
34 | 34 | }); |
35 | 35 | |
36 | -Manager::schema()->create('activations', function (Blueprint $table) { |
|
36 | +Manager::schema()->create('activations', function(Blueprint $table) { |
|
37 | 37 | $table->increments('id'); |
38 | 38 | $table->unsignedInteger('user_id'); |
39 | 39 | $table->string('code'); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $table->foreign('user_id')->references('id')->on('user'); |
44 | 44 | }); |
45 | 45 | |
46 | -Manager::schema()->create('persistences', function (Blueprint $table) { |
|
46 | +Manager::schema()->create('persistences', function(Blueprint $table) { |
|
47 | 47 | $table->increments('id'); |
48 | 48 | $table->unsignedInteger('user_id'); |
49 | 49 | $table->string('code')->unique(); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $table->foreign('user_id')->references('id')->on('user'); |
52 | 52 | }); |
53 | 53 | |
54 | -Manager::schema()->create('reminders', function (Blueprint $table) { |
|
54 | +Manager::schema()->create('reminders', function(Blueprint $table) { |
|
55 | 55 | $table->increments('id'); |
56 | 56 | $table->unsignedInteger('user_id'); |
57 | 57 | $table->string('code'); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $table->foreign('user_id')->references('id')->on('user'); |
62 | 62 | }); |
63 | 63 | |
64 | -Manager::schema()->create('roles', function (Blueprint $table) { |
|
64 | +Manager::schema()->create('roles', function(Blueprint $table) { |
|
65 | 65 | $table->increments('id'); |
66 | 66 | $table->string('slug')->unique(); |
67 | 67 | $table->string('name'); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $table->timestamps(); |
70 | 70 | }); |
71 | 71 | |
72 | -Manager::schema()->create('role_users', function (Blueprint $table) { |
|
72 | +Manager::schema()->create('role_users', function(Blueprint $table) { |
|
73 | 73 | $table->unsignedInteger('user_id'); |
74 | 74 | $table->unsignedInteger('role_id'); |
75 | 75 | $table->timestamps(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $table->foreign('role_id')->references('id')->on('roles'); |
79 | 79 | }); |
80 | 80 | |
81 | -Manager::schema()->create('throttle', function (Blueprint $table) { |
|
81 | +Manager::schema()->create('throttle', function(Blueprint $table) { |
|
82 | 82 | $table->increments('id'); |
83 | 83 | $table->integer('user_id')->unsigned()->nullable(); |
84 | 84 | $table->string('type'); |
@@ -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)); |